Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a PHP script using windows schedule task?

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 the script to run for particular period?

like image 332
aron n Avatar asked Jan 15 '11 20:01

aron n


People also ask

How do I run a cron job in PHP?

Execute – the cron job needs to be called in PHP to run – that's located at /usr/bin/php path. Script Path – the path of the file you want to run. Output – you are allowed to add the cron output to a file or discard it. /dev/null 2>&1 will discard.

How do I trigger a PHP file?

php” file is placed inside the “htdocs” folder. If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.


1 Answers

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
like image 100
Pekka Avatar answered Oct 11 '22 08:10

Pekka