Laravel Requires the Mcrypt PHP Extension for 256-bit encryption/decryption. It is a encryption Algorithm,Supports many encryption algorithms. Here is the list of supported encryption’s.
- Blowfish (default),
- TWOFISH, TEA,
- RC2 and GOST in CBC,
- CFB and
- ECB cipher modes.
While Installing Laravel on your local machine, you need to enable Mycrypt to perform authentications.
When you get an error ” Laravel requires the Mcrypt PHP extension” while trying to install laravel, your Server doesnot enabled the Mcrypt extension. Dont get stressed. Its yet simple to enable and install on your Apache. There is a lot more to discuss with it. So lets start with OS based steps to install Mcrypt on your machine. Lets begin with Mac.
If you are a Mac User, just follow the steps to enable Mcrypt on your XAMPP.
1. Go to Terminal and Enter which php
2. If it says /usr/bin/php, then proceed with next step .
3. Enter the code.
sudo nano ~/.bash_profile //(or sudo vim ~/.bash_profile if you know how to use it)
4. Then paste this export path
5, And Press Ctrl – O then enter to save, then ctrl – X to exit. that’s it.
cd ~ type . .bash_profile
than restart terminal again and Enter which php
If you did it right, it should be the same as the path in #4.
if the above steps does not helped, than try this one
brew install php55-mcrypt
* If homebrew Installed this one help you to install Mcrypt in it.
2. Windows :
Open your ” php.ini ” file and goto to bottom and find “mcrypt” and check all the settings are same as the following one.
change from ;extension=php_mcrypt.dll
to extension=php_mcrypt.dll .
and if you can find the above code. use the following method and confirm the following code is one and same.
[mcrypt] ; For more information about mcrypt settings see http://php.net/mcrypt-module-open ; Directory where to load mcrypt algorithms ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) ;mcrypt.algorithms_dir= ; Directory where to load mcrypt modes ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) ;mcrypt.modes_dir=
If it’s not commented, change based on the above one. This is tested on Xampp. 1.8.2.
3. Linux :
if you are using Ubuntu, try this.
sudo php5enmod mcrypt
It helped me to install mcrypt. If you cant install try the brief one.
The above one doesnot help you, because your PHP doesnot compiled with Mcrypt. So we need to install it now.
sudo apt-get install php5-mcrypt
The above one helps you to install mcrypt. After installing php5-mcrypt you have to make a symlink to ini files in mods-available Here is the one:
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
sudo php5enmod mcrypt
now restart your php5-fpm:
sudo service php5-fpm restart .
That’s it. Remember all the steps needs to restart your server to take effect.