您的位置:首页 > 编程语言 > PHP开发

mac10.11 php报错 Use of undefined constant MCRYPT_RIJNDAEL_128

2016-01-29 10:39 696 查看
错误的原因是没有安装php的mcrypt扩展,却用到了扩展里定义的加密方式的常量

解决办法:安装mcrypt扩展

具体步骤:

1、打开命令行 安装mcrypt :brew install mcrypt

2、安装php-mcrypt扩展: brew install php55-mcrypt(安装自己的php对应的版本)

中间如果遇到错误,静下心来,认真读一下英文代码,都能解决

3、
看一下扩展是否已经装好


php -m | grep mcrypt


php -i | grep mcrypt




     4、复制mcrypt的配置到php扫描配置的目录

默认为--with-config-file-scan-dir=/Library/Server/Web/Config/php' 可以在phpinfo中Configure Command选项中找到

接下来把mcrypt的ini文件复制进去即可:

sudo mkdir -p /Library/Server/Web/Config/php

sudo cp /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini /Library/Server/Web/Config/php/ext-mcrypt.ini

或者

sudo ln -s /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini /Library/Server/Web/Config/php/ext-mcrypt.ini

最后:
sudo apachectl restart即可


你也可以使用另一种方法安装:
http://jingyan.baidu.com/article/e3c78d644cf1ed3c4c85f5a8.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: