且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Apache的启动/重新启动后台运行的PHP脚本(在Windows Server)

更新时间:2023-02-22 22:04:04

我想出了一个解决方案:)


  • 创建环境变量指向你的Apache目录

    I come up with a solution :)

  • Create an environment variable pointing to your Apache directory
    APACHE_HOME = C:/PATH/TO_APACHE
    

  • 重命名 %APACHE_HOME%\\ bin中\\ httpd.exe %APACHE_HOME%\\ bin中\\ httpdVendor .EXE

  • 创建一个批处理文件,并把下面的code:

  • Rename %APACHE_HOME%\bin\httpd.exe to %APACHE_HOME%\bin\httpdVendor.exe
  • Create a batch file and put the following code :
    php myscript.php
    %APACHE_HOME%\bin\httpdVendor.exe -k runservice
    exit 0
    


  • 下载/安装免费软件 BatToExeConverter (下一步,下一步,...)

  • 打开已安装的转换器和打开您刚创建批处理文件

  • 点击按钮的生成EXE (让默认配置)

  • 保存文件:%APACHE_HOME%\\ bin中\\ httpd.exe

  • 开始您的Apache服务器

  • Download/Install the free software BatToExeConverter (next, next, ...)
  • Open the installed converter and open your freshly created batch file
  • Click on the button Build EXE (let the default configuration)
  • Save the file : %APACHE_HOME%\bin\httpd.exe
  • Start your Apache Server
  • 在测试了:Windows 7中,阿帕奇2.4,蝙蝠先进的EXE转换器2.92

    Tested on : Windows 7, Apache 2.4, Advanced Bat to Exe Converter 2.92