Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am hoping someone here can assist me.

I upgraded php and related files using brew upgrade on my mac which is running Mac OS X 10.8.3. Everything was working fine before and I just wanted to update.

After I ensured that everything was fine as regards config files and vhosts I issued the following command to restart apache:

sudo apachectl restart

I then tried to connect to http://localhost/phpinfo.php

Safari errored out with:

Safari can’t open the page “http://localhost/phpinfo.php” because Safari can’t connect to the server “localhost”.

in the terminal, issuing the following command:

apachectl -V | grep httpd.conf

results in:

-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

Server root is:

ServerRoot "/usr"

and Document Root is:

DocumentRoot "/Volumes/sites"

DocumentRoot has permissions set to 755

As I said, everything was working fine until I restarted apache.

Now, nothing works.

I am completely lost, and I need to get things working again.

share|improve this question
up vote 5 down vote accepted

OK, so I found the culprit.

It is amazing that no error message was visible in console or in the error logs, but I found a site which helped me a lot.

In that post, the author, Josh, suggested restarting apache using the following command:

sudo bash -x /usr/sbin/apachectl -k start

This command provides some error information, and overcomes the frustrating silent termination of Apache.

When I issued the command, it gave me the following output:

$ sudo bash -x /usr/sbin/apachectl -k start
+ ARGV='-k start'
+ HTTPD=/usr/sbin/httpd
+ test -f /usr/sbin/envvars
+ . /usr/sbin/envvars
++ DYLD_LIBRARY_PATH=/usr/lib:
+ LYNX='lynx -dump'
+ STATUSURL=http://localhost:80/server-status
+ LAUNCHCTL=/bin/launchctl
+ LAUNCHD_JOB=/System/Library/LaunchDaemons/org.apache.httpd.plist
+ '[' x '!=' x ']'
+ '[' 'x-k start' = x ']'
+ case $ARGV in
+ /usr/sbin/httpd -k start
httpd: Syntax error on line 118 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/Cellar/php54/5.4.11/libexec/apache2/ into server: dlopen(/usr/local/Cellar/php54/5.4.11/libexec/apache2/, 10): Library not loaded: /usr/local/opt/zlib/lib/\n  Referenced from: /usr/local/Cellar/php54/5.4.11/libexec/apache2/\n  Reason: image not found
+ exit 1

At the end of that snippet, you can see that it is trying and failing to load /usr/local/Cellar/php54/5.4.11/libexec/apache2/

Well, when I upgraded my homebrew installs, php5 was upgraded to 5.4.15, so that path was no longer valid. (Actually, the path was valid, since php was now at 5.4.15, and the path pointed to the older 5.4.11 lib, apache was terminating.

Modifying that line in https.conf solved the issue.

share|improve this answer
This solved my problem exactly. Thank you. – swt83 Apr 10 '14 at 1:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.