php PHP7 Laravel Mcrypt 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34083470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP7 Laravel Mcrypt issue
提问by Bishal Paudel
Since Laravel4 requires mcrypt
extension, and PHP7 doesn't seem to have mcrypt
extension, is there any workaround for this to work?
由于 Laravel4 需要mcrypt
扩展,而 PHP7 似乎没有mcrypt
扩展,是否有任何解决方法可以解决这个问题?
回答by Ryderpro
Had the same issue - PHP7 missing mcrypt.
有同样的问题 - PHP7 缺少 mcrypt。
This worked for me. When asked, keep local PHP configuration files.
这对我有用。询问时,保留本地 PHP 配置文件。
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.
安装后重启 FPM(或 Apache 或 NGINX 等)。
回答by carlituxman
I'm on Mac and with laravel valet I've solved with this:
我在 Mac 上使用 laravel valet 解决了这个问题:
brew install php70-mcrypt
brew 安装 php70-mcrypt
回答by Hemantha
Even if you enable mcrypt in php.ini, this issue may occur. Try the following steps.
即使您在 php.ini 中启用了 mcrypt,也可能会出现此问题。请尝试以下步骤。
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.
我在 ubuntu 16.04 中工作,以下命令也对我有帮助。
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
回答by Sorin
On ubuntu: According to launchpad.netthe package for mcrypt is called php7.0-mcrypt.
在 ubuntu 上:根据launchpad.net,mcrypt 的包被称为 php7.0-mcrypt。
sudo apt-get install php7.0-mcrypt
to install
sudo apt-get install php7.0-mcrypt
安装
回答by Behind Methods
Open terminal with Ctrl + Alt + T and run following commands for PHP7.0 on Ubuntu 16.4
使用 Ctrl + Alt + T 打开终端并在 Ubuntu 16.4 上为 PHP7.0 运行以下命令
sudo apt-get install mcrypt php7.0-mcrypt sudo service apache2 restart
回答by fico7489
php7 have mcrypt, you can enable it in php.ini and then everything will work fine.
php7 有 mcrypt,您可以在 php.ini 中启用它,然后一切正常。
回答by devqin
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.
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
(当错误如configure: 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
.这将安装 mcrypt.sophp-7.0.3/ext/mcrypt/modules
- cp 到
/usr/lib/php/20151012/
什么是共享扩展目录 - 创建一个 mcrypt.ini
/etc/php/mods-available/
写为extension=mcrypt.so
- 创建链接到这个功能,比如
sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini
在/etc/php/7.0/fpm/conf.d
- 创建链接到这个功能,比如
sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini
在/etc/php/7.0/cli/conf.d
sudo service nginx restart
sudo service php7.0-fpm restart
- 是的。
回答by eaglewu
PHP7 contains mcrypt extension internally (source-path/ext/mcrypt/
).
But it depends on Libmcrypt soft.
PHP7 内部包含 mcrypt 扩展 ( source-path/ext/mcrypt/
)。但这取决于Libmcrypt软。
Step 1.
第1步。
Download libmcrypt-x.x.tar.gz from http://mcrypt.sourceforge.net/and build it.
从http://mcrypt.sourceforge.net/下载 libmcrypt-xxtar.gz 并构建它。
cd libmcrypt-x.x
./configure
make
make install
Step 2.
第2步。
Rebuild PHP7 from source and add --with-mcrypt
option.
从源代码重建 PHP7 并添加--with-mcrypt
选项。
./configure ... --with-mcrypt
Other way without rebuilding PHP7
无需重建 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
重启php
回答by joshuamabina
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.
我使用Dotdeb,这是一个额外的存储库,为您的 Debian 服务器(如 Nginx、PHP、MySQL、Redis 等)提供最新的各种酷玩具。
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
更新您的
sources.list
deb http://packages.dotdeb.org {distribution} all deb-src http://packages.dotdeb.org {distribution} all
GnuPG 键
wget https://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg
更新 apt 并构建一些惊人的东西。
sudo apt-get update