douping5015 2013-02-12 17:33
浏览 87

Apache在xampp控制面板上启动时运行php文件,是否可能?

Actually, I created a .php file where implemented all queries to update some status and want to run on apache startup(Apache start on xampp control panel). If it is possible, please tell me details about how to configure and where i have to change the settings to launch the php file..

Thnx

  • 写回答

1条回答 默认 最新

  • drs3925 2013-02-12 20:52
    关注

    XAMPP comes with an apache_start.bat file in xampp's root directory. You can edit this file to include the following line (save a backup copy of the .bat file before editing!):

    php -f  <path to your php script>
    

    place that line before the line with apache\bin\httpd.exe, and your script will execute on apache restart.

    If you haven't added PHP.exe to your environmental variables, you'll have to use the full path to PHP in the command. You should also provide the full path to your php script. For example:

    c:\xampp\php\php.exe -f c:\xampp\htdocs\your-script.php
    apache\bin\httpd.exe
    

    If you run into problems try running your php script from the command line first, just to make sure that it works. It may take some experimentation to correctly set paths, and configure permissions depending on which version of Windows you're using.

    Note that you'll have to run the .bat file to restart apache and execute your script. If you restart apache by clicking the start button in the XAMPP control panel it will ignore the .bat file and your script will not execute. (I'll update this answer if I figure out how to execute the script using the XAMPP control panel's start button)

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大