Mcrypt PHP extension installation for Laravel
The mcrypt php extension is an interface for mcrypt cryptography library. We will see how to install mcrypt php extension for laravel. Laravel 5.1 and later versions removed the need to use mcrypt. The web enabled extensions can differ from command line enabled extensions. To see if mcrypt is enabled run the below command in your terminal.
php -mIf not listed then run the below command from terminal to see where the command line is loading the php.ini file.
php --iniThen enable the extension in php.ini file.
Linux and Mac / OSX users-Open your terminal and enter the below command.
which phpif it shows /user/bin/ php then enter
sudo nano ~/.bash_profileOSX terminal normally points to the native php which is shipped with OSX. You should update your bash profile to include the actual path to PHP
export PATH=/usr/local/php5/bin:$PATH
Ubuntu users-For 14.04 or earlier versions you need to symlink to mods-available.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
Once the mod is installed run the following commands
php5enmodsudo php5enmod mcrypt
sudo service apache2 restart
try the below commands if the above doesnt work.
cd ~sudo apt-get remove php5-mcrypt
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
Laravel doesnot use mcrypt extension anymore. Mcrypt is not in use the last update of libmcrypt was in 2007. Laravel 4.2 has no support anymore. The best and safe option is to update your Laravel to laravel 5.2 or above.
fatima alshehri
20 Mar 2019
nice