To schedule a task to execute a PHP script

Source: Internet
Author: User
There is an email script in the project that needs to go to the database every two minutes to read the unsent messages and send them out. I have no problem running in the browser. But because it needs to run all the time, you want to use Windows's scheduled tasks to do it regularly.
The bat file is written like this:

D:\wamp\bin\php\php5.4.3\php.exe-q D:\wamp\www\cron\mailqueue-2min.php

But the execution of the words always fails to send.
Ask me what the problem is. What is the difference between Php.exe execution and browser operation?


Reply to discussion (solution)

The parameters should use-F.

D:\wamp\www\cron\mailqueue-2min.php inside if there is reqiure or include, please use absolute address, this is the problem!

D:\wamp\bin\php\php5.4.3\php.exe D:\wamp\www\cron\mailqueue-2min.php
Remove the middle-Q to see

Problem solved the problem is not the parameter is the configuration file problem I use the WAMP environment has two INI files two files inside the configuration have to change

  • Related Article

    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.