2

After the Yosemite update yesterday, something is messed up with the Mcrypt extension. The PHP based artistan CLI of the Laravel framework returns:

Mcrypt PHP extension required.

The PATH variable seems to be correct. Where is the misconfig? Before the update everything worked fine.

++++ Configs ++++

Output of 'which php':

/Applications/MAMP/bin/php/php5.6.1/bin/php

'php -v':

PHP 5.6.1 (cli) (built: Oct 13 2014 18:41:35) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

Content of .bash_profile:

export EDITOR=nano export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/mysql/bin export PATH=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH

phpinfo(): enter image description here Mcrypt part

MAMP PRO Version:

3.0.7.1

UPDATE:

Mamp-log says for every extension enabled in php.ini:

PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0

lasagne
  • 643
  • 2
  • 10
  • 23
  • What is the output of `php -m | grep mcrypt`? – l'L'l Oct 19 '14 at 11:55
  • 1
    That means the extension isn't enabled or possibly not installed. Check in your `php.ini` for `extension=mcrypt.so`; if it's not in there add that under the dynamic compiled extensions section. – l'L'l Oct 19 '14 at 16:13
  • It is enabled in /Applications/MAMP/bin/php/php5.6.1/conf/php.ini – lasagne Oct 19 '14 at 17:12
  • If `extension=mcrypt.so` is in the php.ini and it's still not working then you should check that the extension is actually installed, meaning the `mcrypt.so` file. Mine is located in `/lib/php/extensions/no-debug-non-zts-20141012/mcrypt.so` – l'L'l Oct 19 '14 at 17:58
  • Mine is there also. Also getting error in the MAMP log for other extensions. See updated post. – lasagne Oct 19 '14 at 19:53
  • Did you restart Terminal.app? I know that's obvious, but... – l'L'l Oct 19 '14 at 19:58
  • Yes. Even full system restart – lasagne Oct 19 '14 at 20:00
  • Another suggestion, `echo $LD_LIBRARY_PATH` – l'L'l Oct 19 '14 at 20:23
  • Empty output. I use now [Maaaark's suggestion](http://stackoverflow.com/a/26455875/1130036) as temporary workaround. – lasagne Oct 20 '14 at 03:37
  • seems to be broken again using 3.0.7.3 – MB. Dec 19 '14 at 16:04

5 Answers5

3

I just had the same problem.

Just use PHP Version 5.5.17 in MAMP and everything should work fine again.

Remember to switch the version in your .bash_profile too:

export PATH=/Applications/MAMP/bin/php/php5.5.17/bin:$PATH
Maaaark
  • 139
  • 2
  • 12
3

I've contacted MAMP support, and this is what they responded.

Hi,

Our php.ini file is messed up for 5.6.1. Go to your template files and change this line

/Applications/MAMP/bin/php/php5.6.1 ....

to

/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20131226

We will have a full fix in a few days. You can also just downgrade to php 5.5. in the meantime.

Community
  • 1
  • 1
Nicolas Widart
  • 1,187
  • 4
  • 13
  • 30
2

The hotfix was applied this morning MAMP & MAMP PRO 3.0.7.2 Published: 2014-10-21. Default php 5.6.2

Don't forget to update .bash_profile

export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH

Everything works fine on my local and it also works fine with drush (for those that use it)

C13L0
  • 611
  • 6
  • 8
1

the same error with you, but I perfect sloved it now:

  • Stop your MAMP
  • Open /Applications/MAMP/bin/php/php5.6.1/conf/php.ini
  • Find all "no-debug-non-zts-20121212" replace by "no-debug-non-zts-20131226"
  • Open /Applications/MAMP/bin/php/php5.6.1/conf/pear.conf
  • Find "no-debug-non-zts-20100525" replace by "no-debug-non-zts-20131226"
  • Start your server

I recommend you unistall OS X's default php and apache Path:

/etc/apache2
/usr/include/apahce2
/usr/libexec/apache2
/usr/php
/usr/bin/php
/usr/bin/php-config
/usr/bin/phpize
/usr/include/php
/usr/lib/php
/usr/share/man/man*/php*
/usr/bin/phar.phar

then

sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pear /usr/bin/pear
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/peardev /usr/bin/peardev
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pecl /usr/bin/pecl
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phar.phar /usr/bin/phar.phar
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php /usr/bin/php
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-cgi /usr/bin/php-cgi
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-config /usr/bin/php-config
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phpize /usr/bin/phpize
liasica
  • 23
  • 4
0

1) First check what php.ini file is loaded:

php --ini

You will probably see that none of the files have been loaded.

2) If you don't mind reinstalling php you can do this:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

3) Then set the path to your new php installation in order to avoid using the native php that comes with OSX.

In order to set the path use this command - something like this, bear in mind that your path could be different:

export PATH=/usr/local/php5/bin:$PATH

LukeSz
  • 1
  • 1