| This article introduces how to set the php program to be automatically executed on a regular basis in a windows environment. For more information, see. Follow these steps: click start, select "program"> "appendix"> "system tools"> "task Plan" (or "set"> "control panel"> "task Plan "), start the task scheduler management program for Windows 2000. In the "Task Scheduler" window, double-click the "Add Task Scheduler" icon to start the "Task Scheduler wizard" of the system, and then click "next, select the application to be automatically run in the program list, and click "next. Set the appropriate task plan name and select the time frequency for automatic execution of the task (such as daily, weekly, monthly, one-time, every start of the computer, and every login time ), click "next. At this time, the system will require the user to set the specific time for the program to run, such as the number, the number of minutes, and the time period to run. we only need to set the time according to our own needs. Next, the system requires the user to set the appropriate user name and password (as shown in figure 5) so that the system can run automatically in the future. Finally, you only need to click the "finish" button to add the corresponding task to the task scheduler in Windows 2000. then it will automatically "remember" this task, once the system time and related conditions are consistent with the user's plan, it will automatically call the user's specified application, very convenient (every time Windows 2000 is started, the task scheduler will be automatically started and run in the background to ensure that your plans can be executed on time ). Right-click the php program icon (6) and choose run from the shortcut menu ". In general, the program icon can be started as long as it is activated and running. If the operation fails, check whether the user and password are correctly set, and check whether the "Task Scheduler" service has been started. I originally switched it off to save system resources, causing the operation to fail, I have been searching for it for a long time. In addition, you can also view in the system log what caused the operation failure. The following are two examples: 1. run the test. PHP file on a regular basis in php: Add a Task Scheduler and enter the command: D: \ php4 \ php.exe-q D: \ php4 \ test. php. Set the time to run the task once every one minute. Now let's see if the content in the d: \ php4 \ test.txt file is successful. If the content is as follows, it indicates successful: 11:08:01 let PHP run on a regular basis! 11:09:02 let PHP run on a regular basis! 11:10:01 let PHP run on a regular basis! 11:11:02 let PHP run on a regular basis! Second, mysqlimplements automatic file backup.php. if you want to compress the file, you can save rar.exe: Backup Ver 0.01, for Win95/Win98/WinNT/Win2000/WinXP on i32Copyright (C) 2000 ptker All rights reserved. this is free software, and you are welcome to modify and redistribute itunder the GPL license PHP Shell script for the backup MySQL database. Usage: Can be database name you wowould like to backup. With the -- help, or -? Options, you can get this help and exit. . /$ Dbname. SQL "); @ exec (" $ rar_tool a-ag_yyyy_mm_dd_hh_mm mongodbname.rar $ dbname. SQL "); @ unlink (" $ dbname. SQL "); echo" Backup complete! ";}?> Add a Task Scheduler and enter the command D: \ php4 \ php.exe-q D: \ php4 \ backup. php databasename to run the task once every day. Finally, an rarfile consisting of the database name and current time will be generated in the d: \ php4 \ directory. Of course, there are many backup methods, so readers can do what they like! If an error occurs: the specified error occurs when you try to set the task account information: 0x80070005: Access Denied. you do not have the permission to run the requested operation. In the above '"4. next, the system will require the user to set the appropriate user name and password, so that the system can automatically run in the future ". it is best to use a "system" user. The password can be blank. this system has a very high level of permissions, which is higher than your administrator, so you should never mess up when running the command, but if there is no prompt, it will be executed unconditionally, you can kill the core process with this permission. 2. add a Task Scheduler. in this step, enter the command: D: \ php4 \ php.exe-q D: \ php4 \ test. the correct php method should be "D: \ php4 \ php.exe"-q "D: \ php4 \ test. php "note: the path should be enclosed in double quotation marks. do not make a mistake. |