Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel requires the Mcrypt PHP extension

I am trying to use the migrate function in Laravel 4 on OSX. However, I am getting the following 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?

enter image description here

like image 984
Patrick Reck Avatar asked May 30 '13 07:05

Patrick Reck


People also ask

What is mcrypt PHP extension required?

The mcrypt extension is an interface to the mcrypt cryptography library. This extension is useful for allowing PHP code using mcrypt to run on PHP 7.2+. The mcrypt extension is included in PHP 5.4 through PHP 7.1.

How do I enable PHP extension mcrypt?

You can install Mcrypt from the PHP Source Tree as a module if you choose. Enable the module by adding: 'extension=mcrypt.so' to PHP. ini. Done!

How do I install mcrypt in Laravel?

To install the mcrypt php extension, do this: sudo apt-get install php5-mcrypt. and restart the server. sudo service apache2 restart. By the way, this might be off-topic, but let’s be honest: Laravel is a wonderful thing, but the install instructions are ..

How to enable mcrypt extension in PHP?

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.

How to get started with Laravel with MAMP?

The easiest way is to download MAMP and let him install everything for us, like PHP, Apache and MySql, something that you’ll need for sure if you’re intended to build something with Laravel. Also, remember to install Composer to manage all the dependency of PHP and help you out a lot with Laravel, but not only. And here comes the pain!

What is the best way to get started with Laravel?

The easiest way is to download MAMP and let him install everything for us, like PHP, Apache and MySql, something that you’ll need for sure if you’re intended to build something with Laravel. Also, remember to install Composer to manage all the dependency of PHP and help you out a lot with Laravel, but not only.


1 Answers

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 or add .bash_profile in 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 are using and then replace with the PHP version above.

Then restart the terminal to see which PHP you are using now.

And it should be working now.

like image 119
JustinHo Avatar answered Sep 29 '22 09:09

JustinHo