Installing laravel on a ubuntu 14.04 droplet

May 24, 2014 28.7k views
Hi , I would wish to install laravel on a ubuntu 14.04 droplet that i have created. For some reason , I keep getting this message "MCrypt PHP extension is required " although i believe i have it already installed. Just to verify I have executed the following commands 1. sudo apt-get install php5-mcrypt (I get the message - php5-mcrypt is already the newest version.) 2. Just o be very sure I have restarted apache as well.. sudo service apache2 restart Is there something that I am missing? Any pointers would definitely help. thanks
1 comment
11 Answers
The article you linked is written for Ubuntu 12.04. On 14.04, you need to enable the mcrypt extension explicitly:
sudo php5enmod mcrypt

Once you've done that, restart your webserver:
sudo service apache2 restart
I also tried following this article on a new droplet word by word and I am still getting the same error on the new droplet. this was the link i was following.
by Wouter ten Bosch
Here's how to install Laravel with Nginx on an Ubuntu 12.04 LTS VPS.
This does not work for me. Using Ubuntu 14.04 droplet and nginx.

Specifically, the following command:

sudo php5enmod mcrypt

results in this:
WARNING: Module mcrypt ini file doesn't exist under /etc/php5/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php5/mods-available
@eric7urner: Have you installed the php5-mcrypt package already?

sudo apt-get install php5-mcrypt
  • I tried this and got a message---
    The following packages have unmet dependencies:
    php5-mcrypt : Depends: php5-common (= 5.4.4-14+deb7u14) but 5.4.6-1ubuntu1.8 is to be installed
    E: Unable to correct problems, you have held broken packages.

    I am new to a linux and am clueless about the issue.

After installing php5-mcrypt :

- you have to make a symlink to ini files in mods-available:

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini

- enable:

sudo php5enmod mcrypt

- restart php5-fpm:

sudo service php5-fpm restart

See here:
On Ubuntu 14.04, you shouldn't have to do the manual linking of mcrypt.ini to the mods-available directory. That bug was fixed. You do need to do that for Ubuntu 13.10.
I don't have the full answer, but here is some more info about the problem. When you follow the D.O. tutorial, you will get php 5.3 installed on Ubuntu 12. Then, as you follow the D.O. tutorial instructions it will lead composer to install the latest version of Laravel, which is 4.2.
The problem is that Laravel 4.2 requires php 5.4+, so the Digital Ocean tutorial is no good.
If you try the tutorial with Ubuntu 14 instead of Ubuntu 12 you will run into a problem/bug with mcrypt and nginx that I have not solved yet, sorry I can't help with that.
I submitted a D.O. support ticket on this issue and hope that the article will be updated soon.
Meanwhile, your best bet might be to direct composer to install Laravel 4.1 instead of 4.2. You should be able to find info on how to get composer to install an older version of laravel.
Hope this helps.
@mh22: To get it running on 12.04, you have a few options. One option would be to enable this PPA and upgrade php to 5.5:


The maintainer of that PPA is one of the Debian Maintainers of the
php5 package, so it's reputable. Though there is always a chance of
issues when backporting such a major package.

Or you could just force the installation of an older version of Larvel:

composer create-project laravel/laravel /var/www/laravel/ 4.1

I was having the same issue in 14.04. I tried all of the symlinks and everything I could find. I finally got it to work by:

1) Removing the existing php5-mcrypt package:

sudo apt-get purge php5-mcrypt

2) Reinstalling the php5-mcrypt package:

sudo apt-get install php5-mcrypt

The reinstall put php5-mcrypt into mods-available where it should be.

4) Enable the mod:

sudo php5enmod mcrypt

5) Restart Apache

sudo service apache2 restart

I'm getting same issue with ubuntu 14.04 and Lampp. I have php5-mcrypt installed but can't enable it. When I run sudo php5enmod mcrypt its give me this error WARNING: Module mcrypt ini file doesn't exist under /etc/php5/mods-available

Please help.

  • Does /etc/php5/mods-available/mcrypt.ini exist?

    ls /etc/php5/mods-available/mcrypt.ini

    If it does, you can enable it by running the following commands:

    cp /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/mcrypt.ini
    sudo service apache2 restart

Dont worry about it, the conf file is already on etc/php5/mods-available/mcrypt.ini
skip that step.

Have another answer? Share your knowledge.