Since Laravel4 requires mcrypt
extension, and PHP7 doesn't seem to have mcrypt
extension, is there any workaround for this to work?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
On ubuntu: According to launchpad.net the package for mcrypt is called php7.0-mcrypt.
sudo apt-get install php7.0-mcrypt
to installHad the same issue - PHP7 missing mcrypt.
This worked for me. When asked, keep local PHP configuration files.
Restart FPM (or Apache or NGINX etc.) after installation.
Even if you enable mcrypt in php.ini, this issue may occur. Try the following steps.
I am working in ubuntu 16.04 and the following commands also helped me.
Open terminal with Ctrl + Alt + T and run following commands for PHP7.0 on Ubuntu 16.4
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
/usr/lib/php/20151012/
what is the shared extensions dir/etc/php/mods-available/
write asextension=mcrypt.so
sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini
in/etc/php/7.0/fpm/conf.d
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
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.
Step 2.
Rebuild PHP7 from source and add
--with-mcrypt
option.Other way without rebuilding PHP7
Restart php