Laravel Requires the Mcrypt PHP Extension: Troubleshooting on OSX
When attempting to utilize the migrate function in Laravel 4 on OSX, you may encounter an error indicating that Laravel requires the Mcrypt PHP extension. Despite appearing to be enabled, the issue persists.
Troubleshooting:
As mentioned, Mcrypt is indeed enabled in your environment. However, it's crucial to consider whether you have MAMP installed on your OSX machine. MAMP is a commonly used development stack that includes its own PHP version, which can conflict with the system PHP when using Laravel's migrate function.
To determine if MAMP is the culprit, use the command which php in the terminal to check the currently active PHP version. If it's not the PHP version associated with MAMP, you'll need to modify your .bash_profile file.
Navigate to /Users/
Within the .bash_profile, add the following line:
export PATH=/Applications/MAMP/bin/php/php<version>/bin:$PATH
Replace
Save the .bash_profile file and restart the terminal. Check the active PHP version again using which php. It should now point to the PHP version from MAMP.
Restart your Laravel project and attempt the migration process once more. The error regarding Mcrypt should now be resolved.
The above is the detailed content of Laravel Migration Error: Is MAMP's PHP Version Conflicting with My System's?. For more information, please follow other related articles on the PHP Chinese website!