I am trying to use the migrate
function in Laravel 4
on OSX
. However, I am getting the following error:
Laravel requir
$ brew install mcrypt php70-mcrypt
I am running PHP 7.0.x, so change "php70" to your version, if you are using a different version.
As stated in other answers, you can see your php version with $ php -v
.
The web enabled extensions and command line enabled extensions can differ. Run php -m
in your terminal and check to see if mcrypt
is listed. If it's not then check where the command line is loading your php.ini
file from by running php --ini
from your terminal.
In this php.ini
file you can enable the extension.
I have heard of people on OSX running in to problems due to the terminal pointing to the native PHP shipped with OSX. You should instead update your bash profile to include the actual path to your PHP. Something like this (I don't actually use OSX so this might not be 100%):
export PATH=/usr/local/php5/bin:$PATH
On earlier versions of Ubuntu (prior to 14.04) when you run sudo apt-get install php5-mcrypt
it doesn't actually install the extension into the mods-available
. You'll need to symlink it.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
On all Ubuntu versions you'll need to enable the mod once it's installed. You can do that with php5enmod
.
sudo php5enmod mcrypt
sudo service apache2 restart
NOTES
- PHP 7.1 deprecated mcrypt and 7.2 has removed the mcrypt extension entirely
- Laravel 5.1 and later removed the need for mcrypt
My OS is Yosemite
.
I resolve this issue, by finding configuration paths:
php --ini
Example output:
Configuration File (php.ini) Path: /usr/local/etc/php/5.5
Loaded Configuration File: /usr/local/etc/php/5.5/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.5/conf.d
Additional .ini files parsed: (none)
Next steps:
Commands:
mv /usr/local/etc/php/5.5/php.ini /usr/local/etc/php/5.5/php.ini.default
ln -s /etc/php.ini /usr/local/etc/php/5.5/php.ini
sudo apachectl restart
Then you can check your php modules via:
php -m
sudo php install mcrypt
sudo php5enmod mcrypt