After upgrading to Snow Leopard last week several things broke. One of the victims was Apache.
I like to keep my environment as “stock” as possible. Fewer customizations means having to work around fewer things as I make the changes that I absolutely need to make.
Since Snow Leopard comes bundled with updated versions of both Apache and PHP, I decided to use those versions instead of the MacPorts versions which I had to use on Leopard. However, after removing the MacPorts versions and enabling the default versions I still couldn’t get Apache to run properly.
The problem turned out to be what Apple probably considers a “feature”, though I think it’s broken even as such.
The problem is in the apache daemon configuration file: /System/Library/LaunchDaemons/org.apache.httpd.plist
The default version of this file (installed by Snow Leopard) looks like this:
The reason I’ve been unable to access content which Apache should have been serving was these two lines:
<key>Disabled</key>
<true/>
The reason I say that this is still a bug, and should be fixed by Apple is that the Disabled setting remained even after I disabled and then re-enabled the Web Sharing service in my System Preferences. Doing this should have changed that value.
So, in order to get Apache running properly again I had to comment out the Disabled setting, like so.
I've got a masters degree in computer science and over 10 years of experience building web-based systems using Java/J2EE, Ruby, Rails and PHP. I'm a strong believer in the effectiveness of Agile Methods. Read more »
Simple Fix for Apache on Snow Leopard
After upgrading to Snow Leopard last week several things broke. One of the victims was Apache.
I like to keep my environment as “stock” as possible. Fewer customizations means having to work around fewer things as I make the changes that I absolutely need to make.
Since Snow Leopard comes bundled with updated versions of both Apache and PHP, I decided to use those versions instead of the MacPorts versions which I had to use on Leopard. However, after removing the MacPorts versions and enabling the default versions I still couldn’t get Apache to run properly.
The problem turned out to be what Apple probably considers a “feature”, though I think it’s broken even as such.
The problem is in the apache daemon configuration file: /System/Library/LaunchDaemons/org.apache.httpd.plist
The default version of this file (installed by Snow Leopard) looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <true/> <key>Label</key> <string>org.apache.httpd</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/httpd</string> <string>-D</string> <string>FOREGROUND</string> </array> <key>OnDemand</key> <false/> <key>SHAuthorizationRight</key> <string>system.preferences</string> </dict> </plist>The reason I’ve been unable to access content which Apache should have been serving was these two lines:
<key>Disabled</key> <true/>The reason I say that this is still a bug, and should be fixed by Apple is that the Disabled setting remained even after I disabled and then re-enabled the Web Sharing service in my System Preferences. Doing this should have changed that value.
So, in order to get Apache running properly again I had to comment out the Disabled setting, like so.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <!-- <key>Disabled</key> <true/> --> <key>Label</key> <string>org.apache.httpd</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/httpd</string> <string>-D</string> <string>FOREGROUND</string> </array> <key>OnDemand</key> <false/> <key>SHAuthorizationRight</key> <string>system.preferences</string> </dict> </plist>After making this change and restarting my system, everything worked.