can't find mcrypt => Call to undefined function Laravel\mcrypt_create_iv()

前端 未结 10 1785
刺人心
刺人心 2020-12-29 01:04

Trying to set up Laravel and keep getting hit with this error. I installed mcrypt through brew and it is located in /usr/local/Cellar. Any thoughts? .. It\'s not showing up

相关标签:
10条回答
  • 2020-12-29 01:56

    Try sudo php5enmod mcrypt && sudo service apache2 restart

    0 讨论(0)
  • 2020-12-29 01:58

    You need to enable it in your php.ini file as well and probably restart Apache.

    In php.ini you will find ;mcrypt.so and remove the ; from it.

    Or, if it's not in there, just add mcrypt.so somewhere.

    Also the salt option has been deprecated as of PHP 7.0.0. It is now preferred to simply use the salt that is generated by default.

    0 讨论(0)
  • 2020-12-29 02:01

    Ubuntu or any Debian based Linux users can install the required package with apt-get:

    sudo apt-get install php5-mcrypt
    

    Remember to restart the web server afterwards:

    sudo service apache2 restart
    

    If it still doesn't work, try to link the configuration file to the appropriate configuration folder for the web server. Thanks to dave1010 for this hint in the comments.

    sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/   # for Apache
    sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cli/conf.d/       # for CLI
    

    And again, restart the web server:

    sudo service apache2 restart
    

    Perhaps, if not working yet, you need also the line showed by @RahulPrasad, with php5enmod mcrypt.

    0 讨论(0)
  • 2020-12-29 02:02

    You don't have the mcrypt PHP extension installed.

    For a Mac, I followed these instructions: mcrypt on Mac 10.7 or 10.8.

    They look like a lot, but it's not, it's very easy to follow in it works!

    0 讨论(0)
提交回复
热议问题