4

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.
; http://php.net/extension-dir
; extension_dir = "./"
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20121212/"
; extension_dl = On
extension=mcrypt.so
; On windows:
; extension_dir = "ext"

Can you tell me what is wrong with my system.

Saumya Rastogi
  • 13,159
  • 5
  • 42
  • 45
  • I'd recommend not using the apache or PHP which come with the system, and instead install them clean and separate via Homebrew. Then you avoid the whole outdated and changes when upgrade issues. – Alexander O'Mara Sep 26 '16 at 05:36
  • It is best not to use mcrypt, it is abandonware, has not been updated in years and does not support standard PKCS#7 (née PKCS#5) padding, only non-standard null padding that can't even be used with binary data. mcrypt had many outstanding [bugs](https://sourceforge.net/p/mcrypt/bugs/) dating back to 2003. Instead consider using [defuse](https://github.com/defuse/php-encryption) or [RNCryptor](https://github.com/RNCryptor), they provide a complete solution and are being maintained and is correct. – zaph Sep 26 '16 at 22:27
  • Went through every step - I'm on php 5.6.25 and everything compiled and files into the right place, but the php api version number was suddenly different! No idea where to go, but it didn't work. – muz the axe Nov 02 '16 at 05:26

4 Answers4

3

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

Saumya Rastogi
  • 13,159
  • 5
  • 42
  • 45
  • I followed the guide, but still I get the same error for Laravel 4.2 projects. Laravel 5.2 works fine. phpinfo() doesn't show mcrypt. Tried Homebrew installation too, none of it worked yet! Any idea? – Jose Philip Raja Oct 01 '16 at 16:37
  • 1
    @Jose, let me clear you that please use latest php and libmcrypt version that is used by Mac OSX Sierra. The guide which I've mentioned is for Mac OSX El Capitan, thats why you should follow that guide keeping in mind that use latest things to upgrade...!! else all will work like a charm, I hope. – Saumya Rastogi Oct 03 '16 at 04:14
1
brew install homebrew/php/php70-mcrypt
0

You need to set on dynamic extensions.

This line is your problem:

; extension_dl = On

You have to remove the ";"

Unamata Sanatarai
  • 6,475
  • 3
  • 29
  • 51
J Zerbino
  • 11
  • 1
0

In my case I made it work with the following steps:

  • Installed XAMPP with PHP 7.0
  • Added the following in the bash profile file

     export PATH=/Applications/XAMPP/xamppfiles/bin/:$PATH
    

The order is really important as it will find php 7.0 before the system one (5.6).

Baxter Lopez
  • 1,110
  • 1
  • 9
  • 14