Laravel requires the Mcrypt PHP extension

后端 未结 22 1963
生来不讨喜
生来不讨喜 2020-11-22 07:59

I am trying to use the migrate function in Laravel 4 on OSX. However, I am getting the following error:

Laravel requir         


        
相关标签:
22条回答
  • 2020-11-22 08:25

    To those that uses XAMPP 1.7.3 and Mac

    1. Go to Terminal
    2. Enter which php
      • If it says /usr/bin/php, then proceed to 3.
    3. Enter sudo nano ~/.bash_profile (or sudo vim ~/.bash_profile if you know how to use it)
    4. Then paste this export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
    5. Ctrl+O then enter to save, then Ctrl+X to exit.
    6. Type cd ~
    7. type . .bash_profile
    8. restart terminal.
    9. Enter which php. If you did it right, it should be the same as the path in #4.

    The reason for the mcrypt error is because your Mac uses its native php, you need to change it to the one xampp has.

    P.S. I'd recommend using MAMP for Laravel 4 for Mac users, this issue will get resolved along with the php file info error without a sweat, and the php version of xampp is so outdated.

    0 讨论(0)
  • 2020-11-22 08:29

    in ubuntu 14.04 based on your php version : 5.6,7.0,7.1,7.2,7.3

    sudo apt-get install php{version}-mcrypt

    sudo apt-get install php7.1-mcrypt
    
    sudo phpenmod mcrypt 
    
    0 讨论(0)
  • 2020-11-22 08:31

    For php-fpm installations on Ubuntu 14.04, the following worked for me :

    sudo apt-get install php5-mcrypt

    This will create mcrypt.ini file inside /etc/php5/mods-available/

    Then

    sudo php5enmod mcrypt

    will create a symlink in: /etc/php5/fpm/conf.d/

    Just restart php-fpm services sudo service php5-fpm restart

    0 讨论(0)
  • 2020-11-22 08:32

    Getting Laravel working on Apache

    PHP version : PHP 5.5.9

    Ubuntu version : 14.04

    i had a working laravel project on windows. when i copied it to ubuntu server , i started getting the mcrypt error. this after a lot of hours of trial and error

    getting artisan command working

    (if you are having mcrypt error while using artisan command line tool)

    i did a lot of trial and error so each time i run the php5enmod command before, i had error messages. but on fresh install there was no error messages. after this step i got artisan command working

    sudo rm /etc/php5/mods-available/mcrypt.ini
    sudo apt-get purge php5-mcrypt
    sudo apt-get install mcrypt
    sudo apt-get install php5-mcrypt
    sudo php5enmod mcrypt
    

    fixing the browser error

    (if you are having mcrypt error in browser when accessing local laravel index page)

    sudo nano /etc/php5/apache2/php.ini
    

    add the following line under the dynamically compiled extensions section of php ini

    extension=mcrypt.so
    

    restart the apache server , purge the laravel cache and everything working

    0 讨论(0)
  • 2020-11-22 08:34

    If you are using Z Shell, just do the following:

    1. Open terminal
    2. sudo nano ~/.zshrc
    3. Paste this; export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH
    4. Save
    5. Run source ~/.zshrc
    6. Run which php - you should get the MAMP 5.6.10 path

    5.6.10 is the version of PHP you set in your MAMP.

    0 讨论(0)
  • 2020-11-22 08:35

    For non MAMP or XAMPP users on OSX (with homebrew installed):

    brew install homebrew/php/php56-mcrypt

    Cheers!

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