I have installed localhost/server in my machine and I need to run a php script using windows schedule task. how do I add path in \"Actions\" tab in schedule task / cofigure
you can directly call your local host url by using
explorer "http://localhost/yourFile.php"
You can use PHP Command Line to execute it rather then trying to load it through the browser.
Under the actions tab, create a new action and:
-f /path/to/php/file.php
Optionally you can make it start in the script's directory as well.
create Schedule task Scheduler->Actions->Edit Action
if you have php file
Program/script: powershell
Add arguments: curl http://localhost/demo/cron.php
if you have MVC/CMS URL
Program/script: powershell
Add arguments: curl http://localhost/demo/controller/method
Here's how I did it.
In the Run box: c:\location_of_my_php_installation\php.exe -f c:\location_of_my_php_file\php_file.php
In the Start in box: c:\location_of_my_php_installation\php.exe
To create a scheduler in Windows, you need to:
.bat
file on your server or system;.bat
file:“F:\xampp\php\php.exe” -f “F:/xampp/htdocs/sitefolder/test.php”;
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: