0

We want to kill Currently running Apache process using PHP, i am using windows machine with XAMPP server.

I am building application which need to restart Apache automatically after 5 hours , so thought of using PHP coding to stop all existing process of apache and than start again.

Please advise me if anybody has other solution.

5
  • system() function may help you Commented Feb 19, 2013 at 11:41
  • exec() function is an option php.net/manual/en/function.exec.php Commented Feb 19, 2013 at 11:42
  • system() and exec() is the only way I can think of. But the PHP process needs to run as a user who can do this (usually only root can) and letting a PHP script run as root is not a good idea as long as it is public. Inside a cron job I think there is no problem. Commented Feb 19, 2013 at 11:44
  • no cron on windows. Test your PHP script from PHP CLI and use Scheduled Tasks to run your command. Commented Feb 19, 2013 at 11:52
  • System() and exec() is not helping me, can anybody suggest some other solution. Commented Feb 20, 2013 at 5:35

1 Answer 1

1

WinXP SP3 here with xAMPP v1.8.1 VC9:

Other option: Just use apache_stop.bat & apache_start.bat scripts provided with xAMPP windows stack. Test with Scheduled Tasks; there is option Run as choose an admin account.

Sign up to request clarification or add additional context in comments.

1 Comment

look goood, i will go ahead try above process, Thanks in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.