1

I have the opposite question from Why is the PHP version different in phpinfo() and CLI? My question is different from that one because I'm getting the expected PHP for the CLI and the wrong one for my local web server. Also, the solution offered there (changing the the path to the "LoadModule" in apache2/httpd.conf) does not work for me because the PHP version installed by brew has no analogous .so file to go in LoadModule.

I was running PHP 5.5 on Mac El Capitan. I am trying to run Craft CMS on my local machine, which requires mcrypt, which is installed with PHP 5.6 and above.

Using brew, I installed PHP 5.6. But when I run phpinfo(); in my Craft folder I am still on PHP 5.5.

If I go to the command line and say which php, I get:

php is /usr/local/bin/php
php is /usr/bin/php
php is /usr/local/bin/php

Then, /usr/local/bin/php -v gives me: PHP 5.6.30 (cli) (built: Mar 11 2017 09:56:18)

and /usr/bin/php -v gives me:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
PHP 5.5.36 (cli) (built: May 29 2016 01:07:06)

The only place I know PHP is called for the server is in etc/apache2/httpd.conf, where it's called by uncommenting LoadModule php5_module libexec/apache2/libphp5.so.

The brew PHP is in /usr/local/Cellar/php56, but there is no .so file there.

I also have homebrew.mxcl.php56.plistin ~/Library/LaunchAgents, copied from the brew install.

The php.ini file is still the same one from the etc folder.

What should I do to load the newer PHP 5.6 instead of the standard PHP 5.5?

  • Well, where is the location of the other PHP module I want to load? As I sai, there's no .so file in the PHP that brew installed. – David Rhoden May 03 '17 at 03:51
  • I was going to ask if I should go back to using MAMP as I used to do, but I would like an answer to my original question as well. I don't think it's a duplicate of the one I said it was the opposite of. That was a good question with good answers, but my situation is different. Had it answered my question, I wouldn't have asked it. I really need to be shown the exact correct path, and I'd like to know why putting the .plist file in LaunchAgents doesn't launch PHP5.6. – David Rhoden May 03 '17 at 03:55
  • I wasn't able to successfully upgrade using brew. I was able to successfully upgrade by downloading from this source: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6 – David Rhoden May 03 '17 at 12:20

0 Answers0