Since Laravel4 requires mcrypt
extension, and PHP7 doesn't seem to have mcrypt
extension, is there any workaround for this to work?
问题:
回答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.
回答2:
I'm on Mac and with laravel valet I've solved with this:
brew install php70-mcrypt
回答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
回答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
回答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
回答6:
php7 have mcrypt, you can enable it in php.ini and then everything will work fine.
回答7:
do like this:
wget http://jp2.php.net/distributions/php-7.0.3.tar.gz
tar zxf php-7.0.3.tar.gz
cd php-7.0.3/ext/mcrypt
/php7-path/bin/phpize
(when error such asconfigure: error: mcrypt.h not found. Please reinstall libmcrypt
runapt-get install libmcrypt-dev
)./configure --with-php-config=/php7-path/bin/php-config
(sudo) make && make install
.this will install the mcrypt.so inphp-7.0.3/ext/mcrypt/modules
- cp to the
/usr/lib/php/20151012/
what is the shared extensions dir - create a mcrypt.ini in
/etc/php/mods-available/
write asextension=mcrypt.so
- create link to this such as
sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini
in/etc/php/7.0/fpm/conf.d
- create link to this such as
sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini
in/etc/php/7.0/cli/conf.d
sudo service nginx restart
sudo service php7.0-fpm restart
- yes it is.
回答8:
PHP7 contains mcrypt extension internally (source-path/ext/mcrypt/
).
But it depends on Libmcrypt soft.
Step 1.
Download libmcrypt-x.x.tar.gz from http://mcrypt.sourceforge.net/ and build it.
cd libmcrypt-x.x
./configure
make
make install
Step 2.
Rebuild PHP7 from source and add --with-mcrypt
option.
./configure ... --with-mcrypt
Other way without rebuilding PHP7
cd php7-source-path/ext/mcrypt/
/php7-path/bin/phpize
./configure --with-php-config=/php7-path/bin/php-config
make && make install
echo "extension=mcrypt.so" >> /php7-path/ext/php.ini
Restart php
回答9:
I use, Dotdeb, an extra repository providing up-to-date all kinds of cool toys for your Debian servers like Nginx, PHP, MySQL, Redis etc.
Update your
sources.list
deb http://packages.dotdeb.org {distribution} all deb-src http://packages.dotdeb.org {distribution} all
GnuPG keys
wget https://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg
Update apt & build something amazing.
sudo apt-get update