>Number: 1489 >Category: os-windows >Synopsis: problem starting Apache as service >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Nov 27 12:00:00 PST 1997 >Last-Modified: >Originator: [EMAIL PROTECTED] >Organization: apache >Release: 1.3b3 >Environment: NT Server 4.0 (german version) with Service Pack 3 >Description: First I want to say that I've downloaded the Win32 binary from your site. Since I don't have VC++ 5.0, I can't modify some #define's and compile Apache myself.
While I was trying to get Apache run as a service I noticed two problems. 1. I installed Apache not into a \Apache directory so I have to use the -d (or the -f) parameter to start Apache. That works fine as long as I try to start it from the commandline or from the service control panel where I can tell NT to pass some commandline arguments to the service. To get the Apache service running without the service control panel I add the commandline argument to the ImagePath key of the service in the registry. This seemed to work. Apache started fine, but takes all the CPU time writing into the error logfile that it can't find the file /apache/conf/httpd.conf ... This looks very strange since it writes this into the error logfile I've configured in the existing httpd.conf file. Thus Apache knows where to look for the config files ... After I put Apache into a directory \Apache and removed the -d option from the ImagePath it worked fine. 2. I've also played a bit around with the StartServers directive. I set it to 0 and started Apache from the command line to test the modification. It worked. So I then started Apache from the service control panel and it didn't start. After I increased that value again to more than 0 it worked again ... >How-To-Repeat: 1. Put Apache and it's config files into something else than \Apache. Configure it, install it as service, and modify the ImagePath key of the Apache service in the registry (adding the -d option) and start it. 2. Set the StartServers directive to 0 and try start the service. >Fix: 1. I had to use "Apache -i -d c:/programme/Apache" to get Apache installed as service. Just "Apache -i" didn't work (it claimed that I can't find the file /apache/conf/httpd.conf"). Why not put the passed directory (or file when using the -f option) into the registry when you also mention the -i option ? If no -d or -f option was given you could just write the #define'd root directory into the registry. Later, when the server is started, you could read the(se) value(s) back in and don't need the command line options when using apache as service. Ok, it's very specific to Win32 but that are services also. And I guess you have only to change code that is already very specific to Win32. I suggest you put the values into HKLM\System\CurrentControlSet\Services\Apache\Parameters. You could create two keys there, maybe named ServerRoot and ConfigFile of type REG_EXPAND_SZ (to allow environment variables) ... well, just my 2 cents. 2. Sorry, no idea >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include <[EMAIL PROTECTED]> in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ]