How can I install mcrypt under PHP7? Laravel needs it
Solution 1
Had the same issue - PHP7 missing mcrypt.
This worked for me. When asked, keep local PHP configuration files.
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade
Restart FPM (or Apache or NGINX etc.) after installation.
Solution 2
I'm on Mac and with laravel valet I've solved with this:
brew install php70-mcrypt
Solution 3
Even if you enable mcrypt in php.ini, this issue may occur. Try the following steps.
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
I am working in ubuntu 16.04 and the following commands also helped me.
whereis php -shows the files with this name
php -v -shows the php version
which php -shows current php version that is running on the server
Solution 4
On ubuntu: According to launchpad.net the package for mcrypt is called php7.0-mcrypt.
sudo apt-get install php7.0-mcrypt
to install
Solution 5
Open terminal with Ctrl + Alt + T and run following commands for PHP7.0 on Ubuntu 16.4
sudo apt-get install mcrypt php7.0-mcrypt sudo service apache2 restart
Bishal Paudel
Entrepreneurial developer with 5 years of experience producing e-commerce web applications and firmware. Proven ability to manage complete software development lifecycle (SDLC) as both contributor and team leader. Demonstrated talent for improving productivity and efficiency. Passionate about engineering high-tech solutions for real-world problems. Established capacity for working with very large data sets. Track record of meeting tight deadlines and commercial quality requirements.
Updated on July 09, 2022Comments
-
Bishal Paudel almost 2 years
Since Laravel4 requires
mcrypt
extension, and PHP7 doesn't seem to havemcrypt
extension, is there any workaround for this to work? -
Bishal Paudel over 8 yearsCan you please elaborate how I install
PHP7 Mcrypt
? I tried to find ifPHP7
has anyMcrypt
extension, but to no avail.PHP5
hadMcrypt
asphp5-mcrypt
which can be enabled and disabled easily withphp5enmod
andphp5dismod
respectively. -
Tom Davies about 8 yearsThis worked for me when the ppa for installation via apt-get was failing, so thanks! Would be great if you could fix the formatting in your answer though as it's a little hard to follow.
-
user985366 almost 8 yearsI had to do this first
sudo add-apt-repository ppa:ondrej/php
-
Osama Al-Banna over 7 years@user985366 thanks ...yes we have to do this
sudo add-apt-repository ppa:ondrej/php
and thensudo apt-get update sudo apt-get install mcrypt php7.0-mcrypt sudo apt-get upgrade
and then it worked for me -
user3707264 over 7 yearsIn /etc/php/7.0/cli/conf.d/20-mcrypt.ini you have to check that the extension is enabled: extension=mcrypt.so and not ;extension=mcrypt.so
-
enchance over 7 years@Ryderpro Do we need to install
mcrypt
when we're already gettingphp7.0-mcrypt
? Or are they 2 diff things entirely?