Execute PHP on Windows Server using BAT timing

Source: Internet
Author: User
Execute PHP on Windows Server using BAT timing

There is a similar cmd and bat file on Windows and Linux, the bat file is similar to a shell file, and executing the bat file is equivalent to executing the command inside and out (and, of course, by logic), so We can use the Bat command file to implement PHP timed tasks on Windows servers. In fact, timed tasks on Windows are the same as on Linux, except in different ways and paths. Okay, here we go.

First, create a Cron.bat file in a location you think is appropriate, and then open it with a text editor (Notepad can) and write something like this:

D:\php\php.exe -q D:\website\test.php

The meaning of this sentence is to use Php.exe to execute test.php this PHP file, and the above contab, bypassing the server environment, execution efficiency is relatively high. When you are done, click Save to close the editor.

The next step is to set up a timed task to run Cron.bat. Open: "Start –> Control Panel –> Task Scheduler –> Add Task Schedule", set the time and password of the scheduled task in the Open interface, by selecting, the Cron.bat is mounted. OK, such a timed task is set up, in this timed task right-click, run, this scheduled task began to execute, to the point, will run Cron.bat processing, Cron.bat to execute PHP.

The above describes the Windows Server on the use of bat timed to execute PHP, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.