7

I have updated my php to version 5.4.13 etc and well in the terminal my version of php states this

   PHP 5.4.12 (cli) (built: Mar 16 2013 21:46:23)

But running a composer install io get the following error.

  The requested PHP extension ext-mcrypt * is missing from your system

Anyway i have tried several emthods to get this to work etc and nothing:

I have used the following: Solution One and Solution Two, they both use a similar approach but i stil ge the errors.

I then did a php info test and this shows that the version is 5.3.15 and that mycrypt says mcrypt support is enabled

So is my server using this php and the one in my terminal using another as this what it seems

Any ideas how to fix this?

I am using a MAC Mountain Lion with Mountain Lion Sever (latest), xcode and all operations are up to date and i have restarted the server.

4 Answers 4

10

Got the same error in Linux(Ubuntu 14.04)

Check that ini exists

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

If it is so, check that you have symlink to ini. Something like in directory /etc/php5/cli/conf.d

05-mcrypt.ini -> ../../mods-available/mcrypt.ini

If there is no symlink create it. After installing the php5-mcrypt extension I have no symlink, only ini file. That is why create the symlink manualy.

You can use sudo php5enmod mcrypt to enable the mod. It will create the symlink for you.

3
  • thanks for the reply on this but in the time i have moved over to Virtual servers mainly using Vagrant and a file call Vaprobash. thanks again Apr 29, 2014 at 20:13
  • 1
    Thanks a lot, this worked in Ubuntu 14.04. May I ask a couple questions: 1. How did you guess there was no .ini file? 2. Why does the php5-mcrypt package not do this automatically? Should I report a bug?
    – Aditya M P
    Sep 30, 2014 at 3:34
  • Also, how did you know it had to be 05-filename, and not some other int at the start?
    – Aditya M P
    Sep 30, 2014 at 3:34
4

Try the following solution:

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

Good luck,

-Iulian

1
  • Can you explain how you might do this without php5enmod? Most of us don't have that on our systems. Nov 24, 2015 at 22:25
2

I had the same issue - mcrypt showed as installed for CLI but missing via command line. To fix, I ran

#php -i

to find the location of the command line version's php.ini file and then added

extension=mcrypt.so

After that, running #php -m will show you what modules are installed for the command line version and mcrypt should be there. If not, your "Solution 1" and "Solution 2" options should help you build the module - then just make sure the module is installed (or gets copied) to your php installation's module (extension) directory (something like /usr/lib/php/extensions/no-debug-non-zts-20100525/ or check where extensions_dir value in php.ini points to).

0

Well I simply went back to basics and uninstalled Mac Server and went back to MAMP, this performed all the latest updates and installs required, as my system was conflicting with two separate installs etc

Not the answer you're looking for? Browse other questions tagged .