Running a php script with a .bat file

后端 未结 6 1464
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 20:49

I need to run a php script at midnight every night on my server. On a linux system I\'d set up a cron job, but I\'m stuck with a windows system.

I know I have to set

6条回答
  •  一向
    一向 (楼主)
    2021-01-17 21:36

    Can I suggest a small change.

    echo off
    REM This adds the folder containing php.exe to the path
    PATH=%PATH%;C:\Program Files (x86)\PHP\v5.3
    
    REM Change Directory to the folder containing your script
    CD C:\inetpub\wwwroot\sitename\crons
    
    REM Execute
    php reminder-email.php
    

    PS. Putting Apache,MySQL or PHP in Program Files is a bad idea. Dont use windows folders with spaces in their names.

提交回复
热议问题