win2008 sets the method for scheduled task execution of the PHP file

  • 2020-05-15 02:56:04
  • OfStack

I found some methods for WINDOWS to perform the planned task of PHP on the Internet, and one of them was written completely, but I failed to pass it. Finally, I had to integrate the methods of various schools in order to run successfully here
1. Write an PHP program, named test.php, as follows:

The code is as follows:


<?
$fp = fopen("test.txt", "a+");
fwrite($fp, date("Y-m-d H:i:s") . " PiaoYun.CC Success! \n");
fclose($fp);
?>

Program bold write, what include\require use, no problem

2. Create a new Bat file and name it test.bat, as follows:


D:\php\php.exe -q D:\piaoyuncc\piaoyun.php
// Change the corresponding directory yourself

3. Set up WINDOWS planning tasks:

Start � > Control panel. > Mission planning questions: > Add task plan
Browse the folder and select the bat file above
Set the time and password (log in WINDOWS)
Save it.

4, over! You can try "run" by right-clicking the schedule task

Run PHP on the windows 2008 server using the task plan to generate phpcms v9 sitemaps method:
The code is as follows:


cd e:\wwwroot\piaoyun.cc\ // Switch to the directory where your web application is located
D:\php\php.exe -q e:\wwwroot\piaoyun.cc\sitesmaps.php

The source code for sitesmaps.php is available at the following address:
PHPCMS V9 full station Sitemaps generation [server-side version]


Related articles: