在Apache的启动/重新启动后台运行的PHP脚本(在Windows Server) [英] Run PHP script in background on Apache start/restart(Windows Server)
问题描述
我的Windows Server 2008下对本手册的说明,安装了Apache 2.4和PHP 5.4:
的 Apache的安装手册。
阿帕奇现在作为服务运行。
I've installed Apache 2.4 with PHP 5.4 on Windows Server 2008 following instructions from this manual: Apache installing manual. Apache runs as a service now.
我的应用程序需要一个PHP的WebSocket脚本在后台运行。我与手动运行它:
My application requires a php websocket script to run in the background. I'm running it manually with:
php myscript.php
现在的问题是:是否有一个对系统(阿帕奇)重新启动
The question is: Is there a way to start a background script automatically on system(apache) restart?
我发现下面的<一个href=\"http://stackoverflow.com/questions/2992938/is-it-possible-to-launch-a-php-script-at-apache-startup\">topic,但我不知道在那里我能找到Apache启动脚本为Windows。
I found the following topic, but I didn't know where I could find an apache startup script for Windows.
任何帮助将大大appriciated。
Any help will be much appriciated.
推荐答案
我想出了一个解决方案:)
I come up with a solution :)
APACHE_HOME = C:/PATH/TO_APACHE
%APACHE_HOME%\\ bin中\\ httpd.exe
到%APACHE_HOME%\\ bin中\\ httpdVendor .EXE
%APACHE_HOME%\bin\httpd.exe
to %APACHE_HOME%\bin\httpdVendor.exe
php myscript.php
%APACHE_HOME%\bin\httpdVendor.exe -k runservice
exit 0
%APACHE_HOME%\\ bin中\\ httpd.exe
%APACHE_HOME%\bin\httpd.exe
在测试了:Windows 7中,阿帕奇2.4,蝙蝠先进的EXE转换器2.92
Tested on : Windows 7, Apache 2.4, Advanced Bat to Exe Converter 2.92
这篇关于在Apache的启动/重新启动后台运行的PHP脚本(在Windows Server)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!