laravel PHP mcrypt 未正确编译
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18239817/
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
PHP mcrypt not compiled properly
提问by Fox
I have tried everything but I not able to fix this error. I installed PHP by downloading it and then ran:
我已经尝试了所有方法,但无法修复此错误。我通过下载安装了 PHP,然后运行:
brew install php55-mcrypt
I had initially installed it with PHP 5.3 then Laravel complained that it has to be greater than 5.4. So everything got messed up.
我最初用 PHP 5.3 安装了它,然后 Laravel 抱怨它必须大于 5.4。所以一切都变得一团糟。
I am on MAC 10.7. Can someone help me?
我使用的是 MAC 10.7。有人能帮我吗?
php -v
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
PHP 5.5.1 (cli) (built: Aug 14 2013 10:31:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
回答by Rahman Malik
brew reinstall mcrypt --build-from-source php56-mcrypt --build-from-source
brew reinstall mcrypt --build-from-source php56-mcrypt --build-from-source
Build from source is an option which will force brew to compile from source rather than using a bottle.
从源代码构建是一个选项,它将强制 brew 从源代码编译,而不是使用瓶子。
回答by Rubens Mariuzzo
Since you had a previous installation of PHP (5.3), and now you just installed a newer version (5.5.1), maybe the new PHP installation are pointing to some old locations.
由于您之前安装了 PHP (5.3),而现在您刚刚安装了较新的版本 (5.5.1),因此新的 PHP 安装可能指向了一些旧位置。
Look for any php.ini
you're using, and verify the extension_dir
directive.
查找php.ini
您正在使用的任何内容,并验证extension_dir
指令。
The last suggestion would be to reinstall PHP 5.5.1.
最后一个建议是重新安装 PHP 5.5.1。
回答by kratos
The warning is because of mismatch between php-mcrypt module version and php version in the server. I am not that familiar with brew as I am a Macports user however depending on your unix ditro you can do something like:
警告是因为服务器中的 php-mcrypt 模块版本和 php 版本不匹配。我对 brew 不太熟悉,因为我是 Macports 用户,但是根据您的 unix ditro,您可以执行以下操作:
=======
========
yum list installed | grep php55
=======
========
Sample output:
=======
php55-gd.x86_64 5.2.14-2.el5.art installed
php55-imap.x86_64 5.2.14-2.el5.art installed
php55-mbstring.x86_64 5.2.14-2.el5.art installed
**php55-mcrypt.x86_64 5.1.6-15.el5.centos.1 installed**
php55-mysql.x86_64 5.2.14-2.el5.art installed
=======
We can see the php-mcrypt module associated with earlier version of PHP.
我们可以看到与早期版本的 PHP 相关联的 php-mcrypt 模块。
How to fix the error?
如何修复错误?
Update php-mcrypt module to fix the error.
更新 php-mcrypt 模块以修复错误。
======
======
yum update php-mcrypt
======
======
hope that helps
希望有帮助