简体   繁体   English

在Windows XP中使用PHP重新启动Apache2

[英]Restart Apache2 in Windows XP with PHP

I have a PHP file that when executed must restart Apache. 我有一个PHP文件,该文件在执行时必须重新启动Apache。 I tried as follows: I put in the last line: 我尝试如下:我放在最后一行:

exec('C:\apache2restart.bat');

And the file. 和文件。 Bat 蝙蝠

net stop apache2 && net start apache2

But it's just stopping Apache, it does not restart. 但这只是停止Apache,不会重启。 What am I doing wrong? 我究竟做错了什么?

if a file containing only the start command works, then i suggest you to type this 如果仅包含启动命令的文件有效,那么我建议您键入此文件

    sleep 10

within the two commands (or more than 10 ! just check how long stopping takes and then adjust it) in order to make the batch wait 10 seconds. 在两个命令中(或超过10个!!只需检查停止需要多长时间,然后进行调整),以使批处理等待10秒。 Let me know, i'm curious. 让我知道,我很好奇。

Change the file to 将文件更改为

net stop apache2
net start apache2

尝试执行执行重启脚本的单独批处理文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM