Mcrypt not installed with Laravel Homestead - php

I've just moved from a WAMP installation to Homestead and I can't get my app running.
When running composer install I get this error:
Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'
Many people seem to have problems with that but most of them use custom installation (they install php from scratch for example). I have just followed the steps here.
I tried to grep mcrypt from php --info and not a single line is returned so I assumed mcrypt is not install.
I've run sudo apt-get install php5-mcrypt and it says:
php5-mcrypt : Depends: phpapi-20121212
I could try to install this dependency but I'm wondering if I'm doing something wrong (the point of using Homestead was to get rid of everything but the project itself, I assume).
The php version used in the vm:
PHP 7.0.2-4+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans
(Not sure why it's php 7, I've never asked for that.)
Any help would be greatly appreciated :)

The latest Homestead with PHP7 does not support Laravel 5.0, out of the box.
As mentioned above in the comments this worked:
git clone -b 2.0 https://github.com/laravel/homestead.git

Related

Unable to install Xdebug after upgrading PHP

I have recently upgraded my Mac to run PHP 8. I noticed Xdebug was no longer installed, so I tried to install it again but I get the following error:
% pecl install xdebug
/usr/local/bin/pecl: line 28: /usr/local/Cellar/php#8.0/8.0.15/bin/php: No such file or directory
/usr/local/bin/pecl: line 28: exec: /usr/local/Cellar/php#8.0/8.0.15/bin/php: cannot execute: No such file or directory
I tried the wizard at https://xdebug.org/wizard, but I can't get phpize installed.
My Mac is running Montery 12.0.1, any idea how I can fix this?
I had the same error message, I resolved it by reinstalling PHP 8.0 with homebrew as explained in this answer:
brew install php#8.0
Be careful that homebrew with also try to update all dependencies and other packages.
Then pecl worked again and I could install xdebug.
[22:39:40] coil#mac-mini.home:/Users/coil/Sites/strangebuzz.com$ php -v
PHP 8.0.19 (cli) (built: May 12 2022 09:09:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies
with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
with Zend OPcache v8.0.19, Copyright (c), by Zend Technologies

Uninstall Xdebug 3 and install v2.9.8

I've installed Xdebug in my system. Then in PhpStorm I've done all the configuration to debug the code using Xdebug.
But in Xdebug is not working properly with PhpStorm. So I would like to remove Xdebug from my local machine. But it's unable to uninstall it.
Using the following command I understood it was installed in my local machine:
php -v shows:
PHP 7.3.28-2+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jun 4 2021 21:23:19) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.28, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.28-2+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
But while ran the uninstall command I am getting the following response in terminal:
sudo apt-get remove php-xdebug
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'php-xdebug' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
Previously I was using Xdebug v2.9.8, it was working fine and I was able to debug the code. So I would like to install the same version.
So looking forward for your support to uninstall version 3 and proper command to install version 2.9.8 in my PHP 7.3 version.

Laravel 5.4 with MongoDB MAC Mojave

Hello I having trouble to to install "jenssegers/mongodb": "^3.2" on my local environment.
i have this error:
I have added to my /etc/php.ini full path to extentions="/usr/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so"
restart the php and apache
I have try to find mongodb.ini, fail on that.
I try all the tutorial is google... still no luck
Can any one help me please?
PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
It seems that you forgot to install MongoDB PHP Driver itself.
To do that just install it with pecl:
sudo pecl install mongodb-1.5.3
1.5.3 is the last stable version, so I'd recommend to use it rather than the most recent 1.6.0alpha.
Then, don't forget to add it to your php.ini (run php --ini to see where it's located):
extension=mongodb.so
To test that it works just run:
php -m | grep mongo
If you see mongodb in output, then it works.

Configuring Xdebug debugger on PhpStorm w/ Laravel, Vagrant

Trying to configure my Vagrant server to use Xdebug. Read that it comes with Xdebug, but I checked this and doesn't seem to be true.
SSH into Vagrant machine,
$ php -v
reveals that machine is using
PHP 7.2.0-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Nov 30 2017 13:58:33) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.2.0-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies with blackfire v1.18.0~linux-x64-non_zts72, https://blackfire.io, by SensioLabs
No xdebug. So I tried installing xdebug with
$ brew install homebrew/php/php72-xdebug
Seemed to work. But then I tried finding the path to xdebug.so:
$ locate xdebug.so
/usr/lib/php/20131226/xdebug.so
/usr/lib/php/20151012/xdebug.so
/usr/lib/php/20160303/xdebug.so
Tried putting all of these into php.ini, and they all failed.
Tried installing via
$ sudo apt-get install php7.2-xdebug
E: Unable to locate package php7.2-xdebug
So, I searched, and found:
$ apt search xdebug
Sorting... Done
Full Text Search... Done
php-xdebug/xenial,now 2.5.5-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed] Xdebug Module for PHP
What am I doing wrong to get Xdebug and php configured on my remote machine?
I was testing with Postman using the mapped domain.. Using the actual server IP works.
So, instead of "restfulapi.dev", hit "128.153.123.21" or whatever it is.
Very silly.

Why is the php service missing after installing php on ubuntu?

Just installed a clean copy of ubuntu and php (to start a wordpress blog)
As recommended here, I installed php with
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Which worked great. I can even confirm that PHP v7.0.22 is installed -
> php --version
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
I made some changes to Nginx in order to get it to read PHP files, and I'm trying to restart the php service -
> sudo service php7.0-fpm restart
Failed to restart php7.0-fpm.service: Unit php7.0-fpm.service not found.
- which it's claiming is not found.
In fact, it looks like there is no service at all with a name like "php" installed when I run sudo service --status-all to list everything.
Do I have to do something extra to install the PHP service?
Thanks!

Categories