Laravel requires the Mcrypt PHP extension

后端 未结 22 2035
生来不讨喜
生来不讨喜 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:35

    Or, use:

    sudo apt-get install php5-mcrypt
    

    not sure if this will work on standard PHP installs - I installed php 5.5.7 using the package from :

    sudo add-apt-repository ppa:ondrej/php5 
    sudo apt-get update
    
    0 讨论(0)
  • 2020-11-22 08:35

    You need an all in one environment. You may use MAMP or XAMPP or any other tools. After installing one of these tools you will need to edit(create) your .bash_profile(Assuming that you use bash).

    Or even simple and more professional you can use Laravel Homestead.

    Here is a link to official documentation: http://laravel.com/docs/5.0/homestead

    Also Jeffrey has a free tutorial about it: https://laracasts.com/series/laravel-5-fundamentals/episodes/2

    I advice you to go with homestead because you will preinstall all of the following tools.

    • Ubuntu 14.04
    • PHP 5.6
    • HHVM
    • Nginx
    • MySQL
    • Postgres
    • Node (With Bower, Grunt, and Gulp)
    • Redis
    • Memcached
    • Beanstalkd
    • Laravel Envoy
    • Fabric + HipChat Extension
    0 讨论(0)
  • 2020-11-22 08:40

    This solved it for me on my Linux Mint local enviroment https://askubuntu.com/questions/350942/cannot-get-mcrypt-for-php5

    I needed to make a symlink to my /etc/php5/conf.d/mcrypt.ini file in the following folders /etc/php5/apache2/conf.d/mcrypt.ini and /etc/php5/cli/conf.d/mcrypt.ini

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

    For ubuntu try these steps if others are not working :

    1. cd ~
    2. sudo apt-get remove php5-mcrypt
    3. sudo apt-get install php5-mcrypt
    4. sudo php5enmod mcrypt
    5. sudo service apache2 restart

    Hope that will help. Thanks !

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

    On OS X

    Using MAMP

    Enter the command which php in the terminal to see which version of PHP you are using. If it's not the PHP version from MAMP, the $PATH variable used by Bash will need to be updated.

    First, you should use command "cd /Applications/MAMP/bin/php" to check which php version from MAMP and take note of the version (eg, php5.6.7).

    Once you know the version, you should edit the ~/.bash_profile file (that is, the .bash_profile that is in your home directory) and add an export line:

        export PATH=/Applications/MAMP/bin/php/php5.6.7/bin:$PATH
    

    Make sure that you replace php5.6.7 with the version of PHP that you have selected in MAMP.

    Once the file has been saved, make sure that you close close your Terminal and open it again. Once that has been done, you will be using the PHP that ships with MAMP.


    One way to easily find what the line should be that you need to put inside your .bash_profile is to run the following command inside your terminal:

        echo export PATH=`cat /Applications/MAMP/conf/apache/httpd.conf \
             | grep php | grep -i LoadModule | head -n1 \
             | sed -e 's/^[^\/]*\/\(.*\)\/mod.*/\/\1/'`/bin:\$PATH
    

    Copying and pasting those three lines into your terminal will correctly output the PHP version that has been selected inside the MAMP control panel.

    Using Homebrew/MacPorts

    Make sure that your path contains /usr/local/bin/ (Homebrew) or /opt/local/bin (MacPorts) if you are using PHP that comes with either of these two package managers.

    Checking the PHP path with MacPorts

    You can find the exact location of PHP using MacPorts with the following command:

    port contents php70 | grep bin/php
    

    Note that you should replace php70 with the version of PHP that you have installed.

    Check the PHP path with Homebrew-php

    Homebrew-php (https://github.com/Homebrew/homebrew-php) is a tap that has various different versions of PHP.

    You can find the exact location of PHP using Homebrew with the following command:

    brew --prefix homebrew/php/php56
    

    Note that you should replace php56 with the version of PHP that you have installed.

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

    For those who still come here today:

    Laravel does not need mcrypt extension anymore. mcrypt is obsolete, the last update to libmcrypt was in 2007. Laravel 4.2 is obsolete too and has no more support. The best (=secure) solution is to update to Laravel >5.1 (there is no LTS before Laravel 5.2).

    Mcrypt was removed from Laravel in June 2015: https://github.com/laravel/framework/pull/9041

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