#apache #homebrew #localhost #mac #osx #php #yosemite
I’m running a local server setup for my local web development using the built-in apache + homebrew PHP. After upgrading to OSX Yosemite 10.10.4 on july 2nd 2015, it broke (again). Here are some of the fixes in case anyone is in the same boat.
httpd.conf error 1:
httpd: Syntax error on line 175 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/Cellar/php56/5.6.2/libexec/apache2/libphp5.so into server: dlopen(/usr/local/Cellar/php56/5.6.2/libexec/apache2/libphp5.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.54.dylib\n Referenced from: /usr/local/Cellar/php56/5.6.2/libexec/apache2/libphp5.so\n Reason: image not found
/usr/local/opt/icu4c/lib/libicui18n.54.dylib indeed didn’t exist, but 55.1 did.
Upgrading and reinstalling the Homebrew PHP version should fix that.
brew update brew upgrade brew reinstall php56
Then edit httpd.conf to link to the new PHP (5.6.10 instead of 5.6.2):
LoadModule php5_module /usr/local/Cellar/php56/5.6.10/libexec/apache2/libphp5.so
sudo apachectl restart
This cleared the PHP error, but now apache showed some new errors:
[core:crit] [pid 1661] (24)Too many open files: AH00078: alloc_listener: failed to get a socket for (null) AH00526: Syntax error on line 74 of /private/etc/apache2/users/Berend.conf: Listen setup failed dyld: warning, can't open /dev/dtracehelper to unregister dtrace DOF section
The syntax error line just had a
Listen **** which is very common syntax, so this was a tricky one. The problem appeared to be that my custom .conf file was loaded twice. In httpd.conf I had the following lines:
Include /private/etc/apache2/users/*.conf Include /private/etc/apache2/extra/httpd-userdir.conf
Commenting these out fixed the issue. (Don’t forget to restart apache again.)
Only apply any changes at your own risk. I’m personally terrified while applying these changes and would hate to break it for someone else. I’m just sharing my experience here.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>