You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tim Streater <ti...@clothears.org.uk> on 2013/12/02 16:05:00 UTC
[users@httpd] Re: Stopping httpd.exe on windows
On 02 Dec 2013 at 12:42, Jeff Trawick <tr...@gmail.com> wrote:
> On Mon, Dec 2, 2013 at 7:04 AM, Tim Streater <ti...@clothears.org.uk> wrote:
>
>> I start httpd.exe from a PHP script, using this command string on Win7:
>>
>> start /b "" /d "c:\Program Files (x86)\Apache Software
>> Foundation"\Apache2.2\bin httpd.exe -f z:\path\to\my\httpd.conf
>>
>> where z: is some drive letter and the backslashes are doubled as they are
>> within a PHP string. This appears to work OK. However, when it comes to
>> stopping it I have an error message. I'm trying initially from the console
>> prompt:
>>
>> httpd.exe -k stop -f z:\path\to\my\httpd.conf
>>
>> and the message is:
>>
>> (OS 5)Access is denied. : failed to open the Apache2.2 Service
>>
>> What is the right way to do this?
> There's no "right way" unfortunately. (Somebody needs to add a "-k
> stopconsole" action to do the right thing.)
>
> When you can't hit Ctrl-Break in the console window for an httpd running in
> a console, you have to whack the httpd processes forcibly, and hope that
> nothing needed to be cleaned up.
Jeff,
Thanks for that. The httpd.exe instance is in fact not running in a console, but it amounts to the same thing in terms of my being unable to cleanly terminate it. taskkill doesn't deal with the child task, but I did find pskill after a bit of poking around, that will at least manage that. Ah well. Now I have to verify that I can do that from within a PHP script.
--
Cheers -- Tim
Re: [users@httpd] Re: Stopping httpd.exe on windows
Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Dec 2, 2013 at 10:05 AM, Tim Streater <ti...@clothears.org.uk> wrote:
> On 02 Dec 2013 at 12:42, Jeff Trawick <tr...@gmail.com> wrote:
>
> > On Mon, Dec 2, 2013 at 7:04 AM, Tim Streater <ti...@clothears.org.uk>
> wrote:
> >
> >> I start httpd.exe from a PHP script, using this command string on Win7:
> >>
> >> start /b "" /d "c:\Program Files (x86)\Apache Software
> >> Foundation"\Apache2.2\bin httpd.exe -f z:\path\to\my\httpd.conf
> >>
> >> where z: is some drive letter and the backslashes are doubled as they
> are
> >> within a PHP string. This appears to work OK. However, when it comes to
> >> stopping it I have an error message. I'm trying initially from the
> console
> >> prompt:
> >>
> >> httpd.exe -k stop -f z:\path\to\my\httpd.conf
> >>
> >> and the message is:
> >>
> >> (OS 5)Access is denied. : failed to open the Apache2.2 Service
> >>
> >> What is the right way to do this?
>
> > There's no "right way" unfortunately. (Somebody needs to add a "-k
> > stopconsole" action to do the right thing.)
> >
> > When you can't hit Ctrl-Break in the console window for an httpd running
> in
> > a console, you have to whack the httpd processes forcibly, and hope that
> > nothing needed to be cleaned up.
>
> Jeff,
>
> Thanks for that. The httpd.exe instance is in fact not running in a
> console, but it amounts to the same thing in terms of my being unable to
> cleanly terminate it. taskkill doesn't deal with the child task, but I did
> find pskill after a bit of poking around, that will at least manage that.
> Ah well. Now I have to verify that I can do that from within a PHP script.
>
FWIW, starting with httpd 2.4.7 the child will detect when the parent is
gone and exit itself.
I have a script for Windows that does something similar for different
server software, and in that script I use "taskkill /pid THEPID /t /f". The
/t ("tree kill") takes care of the child.
>
> --
> Cheers -- Tim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
--
Born in Roswell... married an alien...
http://emptyhammock.com/