mac10.11 php报错 Use of undefined constant MCRYPT_RIJNDAEL_128

来源:互联网 发布:mysql group by having 编辑:程序博客网 时间:2024/05/29 10:23

    错误的原因是没有安装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

0 0
原创粉丝点击