I installed Apache, PHP, and Mariadb on my macOS Sierra using this guide. Haven’t setup SSL yet since I don’t need it as of now.

The problem is that I’m unable to update/install plugins when I use PHP 5.6. It’s stuck on Installing or Updating or Updating Package. I’ve enabled debugging for PHP and WP but see nothing in the WP debug log or my PHP error log.

The error I see in Chrome’s console is:
admin-ajax.php Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Nothing in Apache’s error log as well. Only the access logs have a 500:


127.0.0.1 - - [15/May/2017:14:10:56 +0530] "POST /wptest/wp-admin/admin-ajax.php HTTP/1.1" 200 47
127.0.0.1 - - [15/May/2017:14:10:02 +0530] "POST /wptest/wp-admin/admin-ajax.php HTTP/1.1" 500 -
::1 - - [15/May/2017:14:11:24 +0530] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [15/May/2017:14:11:45 +0530] "POST /wptest/wp-admin/admin-ajax.php HTTP/1.1" 200 47

Note that this happens only on PHP 5.6 on my setup (sphp 56). I don’t face this problem on PHP 7 on the same setup (sphp 70). I haven’t tried with 5.5 or 7.0, but will do if it helps in the diagnosis. I also just tried it on MAMP PRO and I don’t face the issue there as well on PHP 5.6.

If the root cause is the 500 error and that means an Apache issue, what could be possibly going wrong with Apache only on PHP 5.6 and not 7.0 ?

Could it be that macOS sierra ships with PHP 5.6 at


➜ ~ /usr/bin/php -v
PHP 5.6.30 (cli) (built: Feb 7 2017 16:06:52)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

And that could be conflicting? Though the Apache setup I did using that link does use the custom installed version and not macOS’ version:


➜ ~ which php
/usr/local/bin/php
➜ ~ php -v
PHP 5.6.30 (cli) (built: May 13 2017 13:36:55)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans

Any thoughts on this issue would be appreciated. Thanks!

Read more here: WordPress admin-ajax.php 500 error with PHP 5.6 on macOS Sierra


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: