saumya04 saumya04 - 11 months ago 262
PHP Question

Facing mcrypt error issue on upgrading to Mac OSX Sierra

After upgrading to Mac OSX Sierra from El Capitan as soon as I run php it denies to run any php project which was previously installed on my system.
That after exploring this issues on internet I came with these options...
After running the below commands:

cd /etc/apache2/
sudo mv httpd.conf httpd.conf.sierra
sudo mv httpd.conf~previous httpd.conf

cd ..
sudo cp php.ini-previous php.ini

sudo apachectl restart

I made my php project work like a charm.
But now I ran into an another issue. That is php mcrypt extension error.
As I run php project (laravel 4.2 project) the project doesn't work and shows me the error - "PHP mcrypt extension required!"
Please help me out with this..
My php.ini file's mcrypt line looks like this

; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20121212/"
; extension_dl = On
; On windows:
; extension_dir = "ext"

Can you tell me what is wrong with my system.

Answer Source

I fixed my problem... To make mcrypt extension work (if you get an error after upgrading) Then follow this guide from scratch...

Please use the updated version of libmcrypt and php (php 5.6 - comes with OSX Sierra) from the mentioned guide (above).

And if your mysql stops working after folowing the above process (as it happened to me :( ), then just remove all the .err files from directory /usr/local/mysql/data and restart your mysql again for more info - see this

To Restart MySQL use this command

sudo /usr/local/mysql/support-files/mysql.server restart

Hope it helps you to upgrade your Mac OSX without any problems and saves your precious hours..!! :D