Can't use PHP extension Mcrypt in Ubuntu 13.10 (Nginx, PHP-FPM)

39,013

Solution 1

I had the same problem after I upgraded to 13.10 this evening. Apparently this is a genuine Ubuntu 13.10 bug: “phpmyadmin do not recognize php5-mcrypt”. The PHP modules got moved from the conf.d directory to the mods-available directory, and the mcrypt module got left behind.

To fix it I put a symlink to the mcrypt.ini file in the PHP config.

Apache

If you use Apache (rather than php-fpm):

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

php-fpm

Or for php-fpm (rather than Apache):

  1. Make symbolic link to ini files in mods-available

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

    sudo php5enmod mcrypt
    
  3. Restart FPM

    sudo service php5-fpm restart
    

Solution 2

Or, use:

sudo apt-get install php5-mcrypt

Im not sure of this will work on standard php installs - I installed php 5.5.7 using the package from:

sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
Share:
39,013

Related videos on Youtube

Marc-François
Author by

Marc-François

Updated on September 18, 2022

Comments

  • Marc-François
    Marc-François over 1 year

    I installed a fresh Ubuntu 13.10 on my laptop. Like I usually do, I install the packages I need for Web development, which are nginx, php5-fpm, mysql, php5-mysql, php5-mcrypt and a few others.

    After editing some configuration files, this usually works.

    But today, since 13.10, an error appears instead of the Web page I expected.

    Laravel requires the Mcrypt PHP extension. 
    

    The package php5-mcrypt has been installed and reinstalled.

    The command php -m doesn't seem to show mcrypt.

    Any idea where the problem could come from? I've done this setup many times and it always worked.

    • Thomas Ward
      Thomas Ward over 10 years
      This is a bug report, ideally, and you should report the bug against php5-mcrypt with ubuntu-bug php5-mcrypt.
    • slier
      slier over 10 years
      thx god, i thought im the only one having this issue..it drive me nuts...
  • Marc-François
    Marc-François over 10 years
    Sorry, I do not use Apache. Your other solution for PHP-FPM didn't work.
  • Marc-François
    Marc-François over 10 years
  • slier
    slier over 10 years
    oh my god thank you so much..i been trying for all solution i can found online but up to no avail..it drive me nuts..i almost give up..thx u
  • Rixhers Ajazi
    Rixhers Ajazi over 10 years
    Wow... I had been fiddling with laravel for the past 2 days... just wow! Thank you Tom! Love the open source community
  • CMCDragonkai
    CMCDragonkai almost 10 years
    This doesn't seem to be required for 14.04 now. Still have to enable it though.
  • kwoxer
    kwoxer about 8 years
    Wow I was always using sudo /etc/init.d/php5-fpm restart and wondering why it does not work. With sudo service php5-fpm restart it works instantly! Thank you.