When I tried to access my laravel after successfull updation, instead of the default page it shows an error in the webpage.

Mcrypt PHP extension required. 

I have tried some fixes like this,

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
ln: failed to create symbolic link ‘/etc/php5/apache2/conf.d/20-mcrypt.ini’: File exists
sudo service apache2 restart
  • 2
    Did you install mcrypt? And have you seen stackoverflow.com/questions/19446679/… – Ronni Skansing May 11 '14 at 11:30
  • @RonniSkansing The solution of the above commented question is already done, thats why it's giving error in second time. – devo May 11 '14 at 11:32
  • @hakre I am already installed it using apt and enabled it. – devo May 11 '14 at 11:33
  • @harke My question is am already installed, enabled, created symbolic link for mcrypt. Then again why the laravel web page shows the mcrypt error? – devo May 11 '14 at 11:35
  • 1
    I had the same problem when upgrading to 14.04, so I execute Laravel artisan commands ./artisan serve --port=8001 in my project folder. – Razor May 12 '14 at 16:00
  • PHP version: PHP 5.5.9
  • Ubuntu: 14.04

After a lot of trial and error and searching around, this is what I discovered.

getting artisan command working

i did a lot of trial and error so each time i run the php5enmod command before, i had error messages. but on fresh install there was no error messages. after this step i got artisan command working

sudo rm /etc/php5/mods-available/mcrypt.ini
sudo apt-get purge php5-mcrypt
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt

fixing the browser error

sudo nano /etc/php5/apache2/php.ini

add the following line under the dynamically compiled extensions section of php ini


restart the apache server, purge the laravel cache and everything working.

  • 1
    Purging the old php5-mcrypt, reinstalling and running php5enmod solved for me. This should be the accepted answer. – Diego Castro Nov 28 '14 at 20:26
sudo apt-get install php5-mcrypt
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
sudo php5enmod mcrypt
sudo service apache2 restart
  • Again no luck, it's shows Mcrypt PHP extension required – devo May 20 '14 at 1:43

In my case, the mcrypt library seems to be here : /usr/lib/php5/20121212/mcrypt.so

So I just created a new file mcrypt.ini in /etc/php5/mods-available and add:


Then I execute sudo php5enmod mcrypt and reload apache

  • I am already have this mcrypt.ini file here and also tried by adding full path to the so file in the ini, but no luck. – devo May 12 '14 at 17:59
  • When you execute sudo php5enmod mcrypt, you got errors or it's return to the next line (prompt)? – Razor May 13 '14 at 9:26
  • It's going to next line without any errors. – devo May 13 '14 at 14:38
  • And of course, you did restart apache after the change right? – adosaiguas May 19 '14 at 14:42

This StackOverflow answer may be what you need: "laravel can't find mcrypt extension in php 5.5".

All I was missing was sudo php5enmod mcrypt; sudo service apache2 restart, but if that hasn't worked for you, the link suggests this:

sudo rm /etc/php5/mods-available/mcrypt.ini
sudo php5enmod mcrypt
sudo service apache2 restart

If there are any other mcrypt ini files in /etc/php5/mods-available/, you may want to consider removing those as well. Let php5enmod do its job & handle that side of things.

  • This one also not working, after removing the available ini file, the php5enmod command shows this warning WARNING: Module mcrypt ini file doesn't exist under /etc/php5/mods-available and it's not creating new ini here. – devo Jun 17 '14 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.