I believe that you can verify the parameters actually passed to the application by running:
ps auxw | grep http
I know when I'm mucking with services, I really like to use Lingon (even though it is no longer actively developed.) It gives a good idea of which tasks are scheduled, it can help for checking that your task set to be active or not, and I believe it'll check the consistency of your plist file (although, since you started from an existing one, it is likely to be good), and it is really nice for editing a launchd plist file. Be sure to look at the expert mode, especially for looking at an existing file, and note that under the help menu, you can access all relevant man pages.
You may want to change the name of your service in the plist configuration file. To check if it is available and on, you can do the following:
service --test-if-available org.apache.httpd && echo "Available" || echo "Not available"
service --test-if-configured-on org.apache.httpd && echo "On" || echo "Off"
[but replace 'org.apache.httpd' in the command with whatever you've configured it to be. Note that you can run
service --list
to see a list of all services, but unfortunately, the data does not go to stdout, and you can't pipe it.]
Another useful tool to help you figure this out is launchctl.
To see which tasks are scheduled, you can run:
launchctl list
Note that you get different results if you do it as a user than if you do it as root. I believe that root sees the tasks that are scheduled from /System/Library/LaunchDaemons and LaunchAgents, and that the user sees ones scheduled from /Library/LaunchDaemons and LaunchAgents.
Launchctl will also let you schedule/unschedule tasks. Note that in the configuration files, there is a key that states if the job is disabled. You can edit the file, or, when using the launchctl load or unload command, you can make use of the -W flag to override the current setting and write it back to disk.
The site you referenced listed the commands to unschedule the original task and schedule in your replacement as:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo launchctl load /Library/LaunchDaemons/org.apache.httpd.plist
which sure looks right (although I'm unsure if sudo is required for the second one).
Why does apache start up differently from System Preferences? I have two guesses.
- It uses /System/Library/LaunchDaemons (and if you backed this up and overrode it, you'd get the results you seek)
- It starts apache directly and does not use launchctl.
I opened Console while toggling the switch. It didn't show anything in system.log. In /var/log/apache2/error.log, it did show that the application was shut down and started up, but I don't know if it was direct or not.
I think what I would do is:
- Remove the /Library/LaunchDaemons/org.apache.httpd.plist
- Back up /System/Library/LaunchDaemons/org.apache.httpd.plist, perhaps to another folder
- Edit it (and I would probably use Lingon) to start apache in 32 bit mode
- See if it works when rebooting/reloading the task
- See if it works when turning web sharing on or off
- If it does work, back up your modified version of the file, too (just in case an OS update stomps on it).