I installed Apache recently and tried to set it up to use launchctl to start it. At first it was giving me an option error code and than all of a sudden it said that the file was missing can anyone help me create a new file for the launch daemon.
i am running 10.10.5 and apache version 2.4.16
-
1Please add your operating system and the Apache installer you used.– klanomathAug 17, 2015 at 21:18
-
i am running 10.10.5 and apache version 2.4.16– kain184Aug 17, 2015 at 21:51
1 Answer
The first measure is to reinstall Apache or at least unzip (untar, ungzip etc) or decompose the installer package to get hold of the file.
If you can't find it: here is a generic com.apache.httpd.plist file from GitHub:
<?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>Label</key>
<string>com.apache.httpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/httpd/bin/apachectl</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Depending on your system version and the flavor (server/client) several different Apple "generated" plists exist. Usually the name is org.apache.httpd.plist.
Example:
Mac OS X Server 10.7.5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/httpd</string>
<string>-D</string>
<string>FOREGROUND</string>
<string>-D</string>
<string>MACOSXSERVER</string>
</array>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
</plist>
The original (unmodified) org.apache.httpd.plist of OS X 10.10.5 Client
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>XPC_SERVICES_UNAVAILABLE</key>
<string>1</string>
</dict>
<key>Label</key>
<string>org.apache.httpd</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/httpd-wrapper</string>
<string>-D</string>
<string>FOREGROUND</string>
</array>
</dict>
</plist>
Please copy & paste it into text file a and safe it with admin rights to /System/Library/LaunchDaemons/ with the name org.apache.httpd.plist. Afterwards you may have to change the permissions/ownership to 644/root:wheel.
-
i have downloaded the version that i installed before how do i get this file out of the tar directory after i have un tared it. or should i just run the configure and install again– kain184Aug 17, 2015 at 21:55
-
-
-
@kain184 I couldn't find the plist file in the tar.gz either. Better to config......make....install it again, yepp. But I'm surprised because the 10.10.5 Client already contains apache 2.4.16. Why do you want to re-reinstall it again? Aug 17, 2015 at 22:16
-
something went wrong with the launchctl to auto start it and i cant find the file anymore where it should be listed so i need the file to fix the auto start. if you can help me i have the config options from the version list if you can help me make the config command i can take care of the rest– kain184Aug 17, 2015 at 22:20