Nirmal
Nirmal

Reputation: 9549

PHP CLI and Task Scheduler problem

I thought I had set up a successful schedule in Windows to run a PHP script. But all I got was an error which slaps only when run through the task scheduler.

Here is how I run the task:

I created a batch file runCron.bat:

start php.exe reportGenerator.php

and placed reportGenerator.php in the same folder as of the batch file.

When I manually execute the batch file, all is well. But when the same batch file is called by the task scheduler, PHP CLI throws the following error:

Could not open input file: reportGenerator.php

What would have been missed? I understand it's a path issue, but where exactly is the issue?

Thank you for any help.

Upvotes: 0

Views: 1358

Answers (1)

user187291
user187291

Reputation: 53940

try

 start php.exe -f c:\full\path\to\reportGenerator.php

it probably looks for the script in the schedulers working directory, not in the bat file dir

Upvotes: 1

Related Questions