top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to stop httpd on windows

+2 votes
647 views

I start httpd.exe from a PHP script, using this command string on Win7:

 start /b  /d ...httpd.exe -f myhttpd.conf

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 pathtomyhttpd.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?

posted Dec 2, 2013 by Jai Prakash

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

Theres no "right way" . (Somebody needs to add a "-k stopconsole" action to do the right thing.)
When you cant 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.

answer Dec 2, 2013 by Sonu Jindal
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.
Similar Questions
+2 votes

I'm trying to set DocumentRoot and the following directory directive relative to ServerRoot:

DocumentRoot "../web"

DocumentRoot is working, but the Directory directive is not. It won't match. If I change the directory directive to an absolute path it will work. Any idea how I can get this to work?

0 votes

My System : CentOS Linux release 7.2.1511 (Core)
My Apache version : Apache/2.4.6 (CentOS)

I have configured two httpd instance.

I'm looking for a way to use "apachectl fullstatus" command for the second instance. Is this possible?

0 votes

I am a bit confused about the mod_rewrite documentation. It shows this rule to block hotlinking:

RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
RewriteRule ".(gif|jpg|png)$" "-" [F,NC]

however, I'd think a better rule would be:

RewriteCond "%{HTTP_REFERER}" "^$" [OR]
RewriteCond "%{HTTP_REFERER}" "!(www.)?example.com/.*$" [OR,NC]
RewriteRule ".(gif|jpg|png)$" "-" [F,NC]

if I want to block anyone manually typing in a link (no referer) + hotlinking (probably has a referer). Do i need the [OR] on the 1st
RewriteCond and not the 2nd one? It seems to work with OR on both conditions.

...