Ubuntu 13.10 (Saucy) comes with PHP 5.5.3 and does not enable mcrypt by default. I am currently working on a personal project that requires to use mcrypt to encrypt and decrypt data. So I will need to enable it manually.

To enable mcrypt is easy, simply following the steps below:

$ sudo mv /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
$ sudo php5enmod mcrypt
$ sudo service apache2 restart

What “php5enmod” does is simply enabling a PHP5 module by creating a symbolic link from conf.d directory to the real config file under “mods-available”.

So, after we run “php5enmod mcrypt” command, the following files will be created:

/etc/php5/apache2/20-mcrypt.ini
/etc/php5/cli/20-mcrypt.ini

which are symlinks to

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

The prefix “20” is the priority of module, and the default is 20 when you run “php5enmod” command.

If you don’t need the mcrypt module for the command line, you can simply remove the symlink under /etc/php5/cli/20-mcrypt.ini.

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *