task scheduler php using windows server 2008

has anyone personally using windows server 2008 task scheduler to run a php5 file

if so how is it done

what do i put in
two textboxes

program script:
add arguments (optional):

i tried putting c:\php.exe and c:\file.php in both text boxes,  alternating both

I also tried using www.website.com/file.php

Nothing works

History will say that the file has been 'run'  but simple php does not run

My example php file is prints to a text file.
This file works.
With task scheduler file.php does not print to a text file.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve BinkCommented:

Running from the command line (which is essentially what Task Scheduler will do) is different from calling it on a website.  It is different not only in the calling semantics, but in the environment created.  Read through that manual section for a more thorough description of the differences, and come back with any remaining questions.
rgb192Author Commented:
does every commandline php file need a shebang line

what should the shebang be
Steve BinkCommented:
The shebang line is only for Linux installations.  Windows uses file associations to do approximately the same thing.  You will need to launch php.exe and use -f option to specify the file to execute.  
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

rgb192Author Commented:

>>"-f option"

what do i put in
two textboxes

program script:
add arguments (optional):
Steve BinkCommented:
That really depends on what you want it to do.  In its simplest form, the command line would be:

c:\path\to\php.exe -f myfile.php

In that case, "c:\path\to\php.exe" is the script/program, and "-f myfile.php" is the argument list.  I'm not sure you need to separate the two, though.  To my recollection, I've always used the full line in the script box, with the appropriate care taken for quoting path/filenames with spaces.

It sounds like you need to learn a little more about task scheduler.  I find the interface very intuitive and slightly less difficult than walking, even with the four or five tabs of information to look at.  See these links for more information:

rgb192Author Commented:
"c:\path\to\php.exe" is the script/program, and "-f myfile.php" is the argument list.  

"c:\path\to\php.exe" is the script/program, and "myfile.php" is the argument list.  

where myfile.php is in the same folder as php.exe

I also tried local location c: for php file and http location
rgb192Author Commented:
when the php file is in the argument list I get

Log Name:      Microsoft-Windows-TaskScheduler/Operational
Source:        Microsoft-Windows-TaskScheduler
Event ID:      101
Task Category: Task Start Failed
Level:         Error
User:          SYSTEM
Computer:      computer
Task Scheduler failed to start "\task" task for user "user". Additional Data: Error Value: 2147750687.

when php file is in script program, I do not get a task scheduler error, file.php does not run

this is why I have to use a .cmd or .bat file
Steve BinkCommented:
Let's see if I can clear this up for you.  Please see the code and images below.
// contents of d:\test.php

After the task runs:

D:\>type \stuff.txt
    [0] => d:\test.php
    [1] => these
    [2] => are
    [3] => arguments

Open in new window

rgb192Author Commented:
i am using another php file

your task scheduler setup made my php file run... thanks

but it only runs for 43 seconds... before timing out
Steve BinkCommented:
That is a separate question troubleshooting the script itself.  Task Scheduler is not responsible for what the task is doing, only for firing it off.  You will need to troubleshoot the script for why it hits the timeout.  I would start with max_execution_time, and some trace code designed to track the progress of the script and the time it takes to execute.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.