How do I run a PHP script using windows schedule task?
Locate the php.exe executable on your system and pass it the name of the script file using the -f
parameter.
Example:
C:\Xampp\php\php.exe -f C:\Xampp\htdocs\my_script.php
Reference:
- Introduction to using PHP on the command line
- PHP command line options
Run PHP script with Windows Task Scheduler, including files fails
this should work:
cd /D "D:\xampp\htdocs\MyApp\App\Cronjobs\"
"D:\xampp\php\php.exe" -f CronjobBase.php MyCronJob
OR:
D:
cd "D:\xampp\htdocs\MyApp\App\Cronjobs\"
"D:\xampp\php\php.exe" -f CronjobBase.php MyCronJob
PHP script in windows task scheduler
I solve it by running my PHP script through batch file.
and scheduling the batch file in Windows task scheduler.
this post helped me so much:
http://www.devside.net/wamp-server/running-php-scripts-as-cron-jobs-on-windows
Creating A Scheduled Task on PHP Running Under IIS
You could use Task Scheduler on the server to run a batch file that runs the PHP script via command line at a regular interval, which i hope should solve your problem.
Related Topics
How to Show Multiple Recaptchas on a Single Page
Insert Multiple Rows With One Query MySQL
Why Does PHP 5.2+ Disallow Abstract Static Class Methods
Woocommerce: Which Hook to Replace Deprecated "Woocommerce_Add_Order_Item_Meta"
The Character Encoding of the HTML Document Was Not Declared
PHP: Warning: Sort() Expects Parameter 1 to Be Array, Resource Given
Round Minute Down to Nearest Quarter Hour
Architecture More Suitable For Web Apps Than MVC
PHP Domdocument Failing to Handle Utf-8 Characters (☆)
PHP Array to Json Array Using Json_Encode();
Creating PHP Class Instance With a String
Pdo Prepared Statement - What Are Colons in Parameter Names Used For
Codeigniter Htaccess and Url Rewrite Issues
Implementing Condition in Xpath
How to Check Whether the User Uploaded a File in PHP