Installing PHP 5.6 on El Capitan: Syntax error with httpd.conf

While I am using MAMP Pro, I need to install Elasticsearch via OS X itself. However, I also need PHP 5.6 and El Capitan comes with 5.5 (I’m using OS X 10.11.6).

I followed a set of PHP installation instructions which resulted in an error:

httpd: Syntax error on line 119 of /private/etc/apache2/httpd.conf:
Cannot load modules/mod_unixd.so into server:
dlopen(/usr/modules/mod_unixd.so, 10): image not found

I did a bit of Googling, but failed to find anything definitive, and I’d prefer not to go making changes to httpd.conf until I have clue one.

I’m using Apache…

Server version: Apache/2.4.18 (Unix)
Server built:   Feb 20 2016 20:03:19
Server's Module Magic Number: 20120211:52
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)


Source: stackoverflow-php