laravel Mac OS X 上需要 Mcrypt PHP 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29329999/
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
Mcrypt PHP extension required on Mac OS X
提问by cyber8200
I keep getting this error
我不断收到此错误
Mcrypt PHP extension required
需要 Mcrypt PHP 扩展
at the bottom after I run a composer update
:
在我运行后的底部composer update
:
Since I am using Mac, I have tried running :
由于我使用的是 Mac,我尝试运行:
brew search mcrypt
brew install php56-mcrypt
brew search mcrypt
brew install php56-mcrypt
I still get the same error message.
我仍然收到相同的错误消息。
回答by cyber8200
Steps
脚步
I solved this by running the following commands
我通过运行以下命令解决了这个问题
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
php --version // To Test your php
sudo composer update
Result
结果
No more Mcrypt warning !!
不再有 Mcrypt 警告!!
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Generating optimized class loader
回答by CharlieJade
After update brew:
更新 brew 后:
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
If you have installed php5.6 (or higher), you can use the following command to find out what versions are available in brew:
如果你已经安装了 php5.6(或更高版本),你可以使用下面的命令来找出 brew 中可用的版本:
$ brew search mcrypt
homebrew/php/php53-mcrypt homebrew/php/php55-mcrypt homebrew/php/php70-mcrypt mcrypt
homebrew/php/php54-mcrypt homebrew/php/php56-mcrypt homebrew/php/php71-mcrypt
In my case, I am using php7.0:
就我而言,我使用的是 php7.0:
$ brew install php70-mcrypt
回答by Jose Carlos Ramos Carmenates
On macOS High SierraI did this steps:
在macOS High Sierra 上,我执行了以下步骤:
1- Search the package:
1-搜索包:
brew search mcrypt
Result:
结果:
==> Searching local taps... homebrew/php/php71-mcrypt mcrypt homebrew/php/php53-mcrypt
homebrew/php/php54-mcrypt homebrew/php/php55-mcrypt homebrew/php/php56-mcrypt homebrew/php/php70-mcrypt libtomcrypt
==> 正在搜索本地抽头... homebrew/php/php71-mcrypt mcrypt homebrew/php/php53-mcrypt
homebrew/php/php54-mcrypt homebrew/php/php55-mcrypt homebrew/php/php56-mcrypt homebrew/php/php70 -mcrypt libtomcrypt
2- Search my php version to know what can I need to install:
2- 搜索我的 php 版本以了解我需要安装什么:
php --version
Result:
结果:
PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS ) 版权所有 (c) 1997-2017 The PHP Group Zend Engine v3.1.0, 版权所有 (c) 1998-2017 Zend Technologies
3- Install the correct package, for me was 7.1.7 => homebrew/php/php71-mcrypt
3- 安装正确的包,对我来说是 7.1.7 => homebrew/php/php71-mcrypt
brew install homebrew/php/php71-mcrypt
4- Find the find "mcrypt.so" extension file
4- 找到“mcrypt.so”扩展文件
find /usr/ -type f -name "mcrypt.so"
Result:
结果:
find: /usr//local/Cellar/php71-mcrypt/7.1.13_19/mcrypt.so
找到:/usr//local/Cellar/php71-mcrypt/7.1.13_19/mcrypt.so
5- Search the php.ini
5- 搜索 php.ini
php -i | grep 'Configuration File'
Result (if exist):
结果(如果存在):
Configuration File (php.ini) Path => /etc Loaded Configuration File => /etc/php.ini
配置文件 (php.ini) 路径 => /etc 加载的配置文件 => /etc/php.ini
6- Add the next line at the end on /etc/php.ini (see the last step your correct path) the extension mcrypt.so
6- 在 /etc/php.ini 的末尾添加下一行(请参阅最后一步您的正确路径)扩展名 mcrypt.so
extension=/usr/local/Cellar/php71-mcrypt/7.1.13_19/mcrypt.so
Finish, you can now execute your command.
完成,您现在可以执行您的命令。
回答by christophetd
You'll need to add the line
您需要添加该行
extension=mcrypt.so
In your phi.ini file responsible for the CLI PHP version. To find where it is, run:
在你的 phi.ini 文件中负责 CLI PHP 版本。要找到它的位置,请运行:
php -i | grep 'Configuration File'
回答by lynx_74
In use XAMPPon my Mac, so I had to install php and then compile mcrypt using pecl, after that I copied mcrypt.so to XAMPP.
在我的 Mac 上使用XAMPP,所以我必须安装 php,然后使用 pecl 编译 mcrypt,之后我将 mcrypt.so 复制到 XAMPP。
The actual list of available releases is: http://pecl.php.net/package/mcrypt
可用版本的实际列表是:http: //pecl.php.net/package/mcrypt
The commands was:
命令是:
echo Install php...
brew install php
/usr/local/opt/php/bin/php -v
echo Correction of "error Connection to `ssl://pecl.php.net:443' failed"...
wget http://curl.haxx.se/ca/cacert.pem
sudo cp cacert.pem /private/etc/ssl/cert.pem
sudo mv cacert.pem /Applications/XAMPP/xamppfiles/share/openssl/cert.pem
/usr/local/opt/php/bin/pecl list-all
echo Compile and Install mcrypt.so...
sudo /usr/local/opt/php/bin/pecl install mcrypt-1.0.1
The last message of build process of peclwas:
pecl构建过程的最后一条消息是:
Build process completed successfully Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/mcrypt.so' install ok: channel://pecl.php.net/mcrypt-1.0.1 Extension mcrypt enabled in php.ini
Build process completed successfully Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/mcrypt.so' install ok: channel://pecl.php.net/mcrypt-1.0.1 Extension mcrypt enabled in php.ini
Based on path of build processI copied the compiled mcrypt.so to XAMPP and enable the extension on php.ini:
根据构建过程的路径,我将编译后的 mcrypt.so 复制到 XAMPP 并在 php.ini 上启用扩展:
sudo cp /usr/local/Cellar/php/7.2.7/pecl/20170718/mcrypt.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/mcrypt.so
echo 'extension=mcrypt.so' >> /Applications/XAMPP/xamppfiles/etc/php.ini
Check if it works:
检查它是否有效:
/Applications/XAMPP/bin/php -i | grep "mcrypt"
The result have to be:
结果必须是:
mcrypt mcrypt support => enabled mcrypt_filter support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value
mcrypt mcrypt support => enabled mcrypt_filter support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value
Remember to restart Apacheto see it working using browser.
请记住重新启动 Apache以使用浏览器查看它的工作情况。
Maybe it helps someone and I win one thumbs up. Thanks
也许它可以帮助某人,我赢得了一个赞许。谢谢