mCrypt not present after Ubuntu upgrade to 13.10

ApacheUbuntu

Apache Problem Overview


After I have upgraded my system from Ubuntu 13.04 to 13.10 several problems have occurred with apache, mysql and php configurations.

I solved most of them but I can't seem to get mCrypt library working. Package is installed so i don't need to apt-get it. Server works and everything seems fine, but when I try to run php artisan serve with Laravel 4, I get a message that mCrypt is required.

I did php --ri mcrypt and the output was Extension 'mcrypt' not present. I have tried putting extension=mcrypt.so to /etc/php5/apache2/php.ini but it didn't work.

Any ideas?

Output of dpkg --get-selections | grep php5

libapache2-mod-php5			install
php5						install
php5-cli					install
php5-common					install
php5-gd						install
php5-json					install
php5-mcrypt					install
php5-mysql					install
php5-readline				install

Apache Solutions


Solution 1 - Apache

I think I found the solution at launchpad.net.

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

This worked for me.

Solution 2 - Apache

I had this problem with Ubuntu 14.04 and I did the following to resolve it:

sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt

sudo service apache2 restart

Solution 3 - Apache

I also have this problem with Ubuntu 14.04 after install.

First enable the mcrypt

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

Add this command in any line

extension=mcrypt.so

Create conf.d folder in /etc/php5

sudo mkdir conf.d

And inside that folder create mcrypt.ini file

sudo gedit mcrypt.ini 

Then add this command to that file

extension=mcrypt.so

Then create a link to file

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

Enable mcrypt module

sudo php5enmod mcrypt

Restart apache

sudo service apache2 restart

Solution 4 - Apache

From Ubuntu 13.10 to 14.04:

sudo php5enmod mcrypt
sudo service apache2 restart

Works for me.

Solution 5 - Apache

I also had this problem with Ubuntu 14.04 and Nginx,but the tip for me was restart the FPM service, so I did:

Install the library > apt-get install php5-mcrypt

Find the path

> updatedb && locate mcrypt.so

Set the path of mcrypt.so inside the mcrypt.ini file located in /etc/php5/mods-available/mcrypt.ini

> extension=/usr/lib/php5/20121212/mcrypt.so

And then restart the FPM service

> service php5-fpm restart

Solution 6 - Apache

Another solution if the package is already installed:

sudo aptitude reinstall php5-mycript

This worked for me after doing upgrade

Solution 7 - Apache

Try this code:

ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
service apache2 restart

Solution 8 - Apache

I had the same problem with PHP 5.5.14 running on Mac OS X Yosemite. I was trying to install Laravel 5.0. And when I tried to create a new project I got an error like below (even when I tried to start the laravel server with php artisan serve

Alejandros-MacBook-Pro:Documents Lexynux$ laravel new blog
Crafting application...
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Generating optimized class loader
Compiling common classes
Compiling views
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Application key [CCOPocoMjnJTx4AFXk64wqyTKyo3BlHq] set successfully.
Application ready! Build something amazing.
Alejandros-MacBook-Pro:Documents Lexynux$ 

So I just added the line below at the end of my php.ini file with the nano editor:

extension=mcrypt.so
sudo nano /etc/php.ini

Finally just restart the Terminal and restart the laravel app server with

php artisan serve

And it works fine!

Solution 9 - Apache

just found on php.net

> Note, for Ubuntu, simply installing php5-mcrypt did not get mcrypt to work. You need to execute the following commands as root to enable it:

apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart

http://php.net/manual/en/mcrypt.installation.php#114609

Solution 10 - Apache

Sometimes, this "problem" occurs because you entered an artisan command on your local machine instead of on your virtual machine. If you are using Homestead, mcrypt is already installed. Consider it a reminder to homestead ssh

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVuk StankovićView Question on Stackoverflow
Solution 1 - ApacheVuk StankovićView Answer on Stackoverflow
Solution 2 - ApacheeaykinView Answer on Stackoverflow
Solution 3 - ApacheDaroathView Answer on Stackoverflow
Solution 4 - ApacheAleftosView Answer on Stackoverflow
Solution 5 - ApacheDeric LimaView Answer on Stackoverflow
Solution 6 - ApacherreimiView Answer on Stackoverflow
Solution 7 - ApacheIndrajeet SinghView Answer on Stackoverflow
Solution 8 - ApachealexventuraioView Answer on Stackoverflow
Solution 9 - ApacheSharkWebView Answer on Stackoverflow
Solution 10 - ApacheChukky NzeView Answer on Stackoverflow