I am creating a rather easy virtual host administrator during my office intranet (on the home windows pc) and I am attempting to restart the apache service from php whenever a new virtual host is produced.

However I can't manage to get it done, I attempted with apache -k restart, httpd -k restart using the system, spend_professional, professional passthru I additionally attempted utilizing a batch file and performing it from php instructions but no avail. You will find no errors, the command just does not get performed

The only method I handled to prevent (although not to restart) the service was by looking into making Internet STOP Apache2.2, and creating a batch file with:

@echo off

Internet STOP Apache2.2

Internet START Apache2.2

did not work either.

Any idea why? I am unaware here. Other instructions get performed all right, but for whatever reason php does not wish to restart the apache service.


Trying this from the inside a script running under apache won't work or fail miserable, on home windows in addition to linux.

Usually user that apache runs as (on any platform) doesn't have the rights to restart apache, also it should stay this way.

As pointed out within the link Haim published, you'll most likely take some type of exterior process or script to restart the server. One method to do this is to possess a script running like a scheduled job check a control file to check on when you should restart the service.

I'd give more particulars regarding how to get it done particularly, but I'm not a home windows expert.