After upgrading to MacOS High Sierra, I haven't been able to access my localhost. I tried restarting Apache, but it still didn't work. So I did apachectl configtest and got this error message:

httpd: Syntax error on line 544 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _environ\n Referenced from: /usr/local/php5/libphp5.so\n Expected in: /usr/sbin/httpd\n

Line 544 of my httpd.conf file is
Include /private/etc/apache2/other/*.conf

The +php-osx.conf is an alias to entropy-php.conf, and line 8 of that file is
LoadModule php5_module /usr/local/php5/libphp5.so

The remaining lines of entropy-php.conf are: LoadModule php5_module /usr/local/php5/libphp5.so

<IfModule mod_php5.c>

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php


I am using Apache/2.4.28 (Unix) and PHP 5.6.30.

Everything was working fine until the update. I have searched online for any solution this issue, but to no avail. Someone posted a similar question here a couple of years ago regarding the same syntax error, however, he didn't provide enough details or any follow-up regarding his setup, and no solution could be offered: Mac apache not working - apachectl configtest errors

  • PHP 5.6.30 is not included in High Sierra! If you use a custom installation you should add the source (e.g. [PHP for OS X](www.php-osx.liip.ch) or brew/MacPorts) and the set-up guide you followed (e.g. coolestguidesontheplanet.com)!
    – klanomath
    Commented Nov 22, 2017 at 22:56
  • Thank you for your response @klanomath. It has been a couple years since I set up my home development server, and the setup guide I followed starts with the assumption that when you start apache, you can access localhost, which I cannot. As High Sierra comes with php7.1, I'd prefer to upgrade my setup to that rather than staying with 5.6. I know I can install it using brew install php71, but what else would I need to do?
    – Paul Brady
    Commented Nov 22, 2017 at 23:58
  • You don't have to install php71 with brew necessarily because macOS 10.13 comes with PHP 7.1.7 by default. My impression is that a lot of web developers have problems with 10.13 because Apple OS installer apparently ignores some custom set-ups while upgrading. Therefore I always ask them which 3rd party packages of PHP|Python|etc. they installed previously and which external set-up guide - each with a slightly different configuration/philosophy - they followed in the past.
    – klanomath
    Commented Nov 23, 2017 at 0:20
  • Upgrade to PHP 7.1 or 7.2 on macOS High Sierra or on OSX 10.6 – 10.11. Don't follow the instructions but check the comments! You probably have to comment out LoadModule php5_module in +php-osx.conf.
    – klanomath
    Commented Nov 23, 2017 at 0:30
  • When I type php -v though it shows I have PHP 5.6.32. Why didn't the update change that to 7.1?
    – Paul Brady
    Commented Nov 23, 2017 at 0:33

1 Answer 1


Here an (old) 3rd party PHP probably from entropy.ch was installed to /local/usr/bin/. The Sierra httpd.conf was modified to work with the different PHP (and virtual hosts).

While updating to macOS to High Sierra, the Sierra httpd.conf was backed up to httpd.conf.sierra, a new High Sierra httpd.conf was installed and gained control, but won't work with the custom PHP5.

After backing up the High Sierra httpd.conf to httpd.conf.high_sierra:

sudo mv /private/etc/apache2/httpd.conf /private/etc/apache2/httpd.conf.high_sierra 

reactivating the httpd.conf.sierra:

sudo cp /private/etc/apache2/httpd.conf.sierra /private/etc/apache2/httpd.conf

uncommenting the httpd.conf line

#LoadModule php5_module libexec/apache2/libphp5.so

and changing the version number from 5 to 7 so that it reads:

LoadModule php7_module libexec/apache2/libphp7.so

renaming the custom /local/usr/bin/php to php5:

sudo mv /local/usr/bin/php /local/usr/bin/php5

replacing the soft link /private/etc/apache2/other/+php-osx.conf (linking to /usr/local/php5/entropy-php.conf) with the High Sierra default /private/etc/apache2/other/php7.conf

and removing any reference to the custom PHP5, apachectl configtest was OK and Apache worked again - now with Apple's PHP7.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .