I am trying to use the migrate function in Laravel 4 on OSX, however I am getting the error
Laravel requires the Mcrypt PHP extension.
As far as I understand, it's already enabled (see the image below).
What is wrong, and how can I fix it?
Answer:
Do you have
MAMP
installed?
Use
which PHP
in the terminal to see which version of PHP you are using. If it's not the PHP version from MAMP, you should edit/add .bash_profile
on the user's home directory, that is : cd ~
.
In
.bash_profile
, add following line:export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
Edited: First you should use command "cd /Applications/MAMP/bin/php" to check which php version from MAMP you gonna use then replace with the php version above.
and restart the terminal to see which PHP you are using now.
And it should be working now.
To those that uses XAMPP 1.7.3 and Mac
- Go to Terminal
- Enter
which php
- If it says
/usr/bin/php
, then proceed to 3.
- If it says
- Enter
sudo nano ~/.bash_profile
(orsudo vim ~/.bash_profile
if you know how to use it) - Then paste this
export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
- Ctrl+O then enter to save, then Ctrl+X to exit.
- Type
cd ~
- type
. .bash_profile
- restart terminal.
- 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 Komentar