On El Capitan, macOS Server 5.2 wants a mismatching PHP component, and on Sierra, 5.2’s PHP configuration is ignored by the operating system. If you really have to run 5.2 on Sierra, here’s a hacky fix.
Although in theory macOS Server 5.x is OS-independent, in practice the 5.2 update runs into problems regardless of whether it’s running on El Capitan or Sierra. The catch is that 5.2 wants newer PostgreSQL components than El Capitan’s PHP 5.5 supports — specifically, the
pgsql.so modules — while on Sierra an apparent oversight on Apple’s part means that macOS Server-specific configuration details for PHP don’t get loaded at all.
On El Capitan, the problem arises because of these two updated lines in the
php.ini file that lives in
These lines replace the corresponding lines from the previous version of Server:
Unfortunately, only the previous version’s lines match up with what is actually available in PHP 5.5 under El Capitan.
In principle, we could roll back to the previous version of these two lines and then drop the older modules directly into the macOS Server package itself. However, not having tested that solution extensively on a live server, I can’t offer any comment on whether it’s a good idea.
Alternatively, if the machine is already running Sierra, then the good news is that the newer versions match up with what is available in Sierra’s PHP 5.6, but the bad news is that PHP has not been compiled to scan the
/Library/Server/Web/Config/php directory at all! So whatever custom configurations might be requird by the Server app, and whatever custom configurations you might have added to the directory on your own, are simply ignored. Since this can only be configured via
--with-config-file-scan-dir when PHP is compiled, we cannot change this behaviour without replacing the whole kit and kaboodle.
If you’re already committed to Sierra, then one solution, for now, is to append the contents of any additional custom configuration files contained in the
/Library/Server/Web/Config/php directory to the end of the main
php.ini file which lives in
/etc. This will ensure that whenever PHP is fired up, it includes the custom configuration which you have set up for macOS Server. (Note the emphasis on whenever: adding the Server-specific configuration lines to the main
php.ini file brings them into play for all use of PHP on the machine.)
Naturally, Apache will need to be restarted before any PHP configuration changes will be seen on your sites:
sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/server-apachectl graceful
Since the main
php.ini file may get overwritten during system software updates, relying on this solution may mean reapplying it in the future.
All material on this site is carefully reviewed, but its accuracy cannot be guaranteed, and some suggestions offered here might just be silly ideas. For best results, please do your own checking and verifying. This specific article was last reviewed or updated by Greg on .