我已经按照本手册中的说明在 Windows Server 2008 上安装了 Apache 2.4 和 PHP 5.4: Apache installing manual . Apache 现在作为服务运行。
我的应用程序需要一个 php websocket 脚本在后台运行。我手动运行它:
php myscript.php
问题是:有没有办法在系统(apache)重启时自动启动后台脚本?
我找到了以下 topic ,但我不知道在哪里可以找到适用于 Windows 的 apache 启动脚本。
我们将不胜感激。
最佳答案
我想出了一个解决方案:)
APACHE_HOME = C:/PATH/TO_APACHE
%APACHE_HOME%\bin\httpd.exe
为%APACHE_HOME%\bin\httpdVendor.exe
php myscript.php
%APACHE_HOME%\bin\httpdVendor.exe -k runservice
exit 0
%APACHE_HOME%\bin\httpd.exe
测试于:Windows 7、Apache 2.4、Advanced Bat to Exe Converter 2.92
关于php - 在 Apache 启动/重启时在后台运行 PHP 脚本 (Windows Server),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14718865/