logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Windows Server 2008: Apache won't restart!
Author
navbeacon



Joined: 17 Jan 2008
Posts: 4

PostPosted: Thu 17 Jan '08 18:49    Post subject: Windows Server 2008: Apache won't restart! Reply with quote

Hi, I have this headache with getting apache to gracefully restart.

I have a php script which runs a .bat file thorugh system('c:/restart.bat');.
Restart.bat contains:
Code:
@echo off
c:/apache/bin/httpd.exe -k restart


However, running this script returns 0, and the error log tells me this:
Code:
httpd.exe: illegal option -- k


It says "Illegal option -- k"? I don't get it.

When I run the script from windows, it works like a charm.

Help? Sad
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 17 Jan '08 21:43    Post subject: Reply with quote

well .. obviously there is a double dash in the script. Check to make sure

-k yes
--k no
Back to top
navbeacon



Joined: 17 Jan 2008
Posts: 4

PostPosted: Thu 17 Jan '08 21:59    Post subject: Reply with quote

Nope, that wasn't the problem. As you can see the command prompt only contain one dash.
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 18 Jan '08 15:56    Post subject: Reply with quote

All the Apache "-k" options will not work from within a process which is running Apache.

If you run this PHP page, and scroll down to the Environment section, you will see an environment variable named AP_PARENT_PID:
Code:
<?php phpinfo() ?>

This environment variable tells Apache it is running in this process and blocks all the "-k" switches. Unfortunately, you cannot unset this variable with the PHP putenv or unset functions. Trying to unset it in the .bat file won't work either.

One possible workaround is to run PHP using mod_fcgid. This will run PHP in a separate process, which won't have AP_PARENT_PID. If you are running Apache 2.2 from Apache Lounge, there is a version of mod_fcgid on the downloads page.

-tom-
Back to top


Reply to topic   Topic: Windows Server 2008: Apache won't restart! View previous topic :: View next topic
Post new topic   Forum Index -> Apache