• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Running a PHP script in windows task scheduler, not working, why?

ZeroX

2[H]4U
Joined
Jan 29, 2001
Messages
2,396
I should say, the PHP script *claims* to run in Task Scheduler on XP, but it effectively does nothing.

I'm using reg.exe to manually update a registry entry based on what the script does, and I'd like it to run daily. The script seems to do nothing when executed by task scheduler, and works perfectly when I execute it manually. I have the script running as Administrator, what else could it be?
 
how do you call the script? i.e., what do you type from the command line (and i assume it's the same from the task manager)
 
PHP is associated in the path and the script itself is in the path, so I can simply type any PHP script filename and it will execute.
 
Even though you have the path and php association set correctly, did you try it with the following in the run: box?

C:\PHP\php.exe file.php

(or your path to php)

That works for me, but I just used a little test file.

Of course it also works for me if I put php in my path and associate the php extension with php.

Here's the code I tested with. It contains an input so when it pops up it pauses, so I know it actually worked.

Code:
<?php 

function read() { 
    $fp=fopen("con", "rb"); 
    $input=fgets($fp, 255); 
    fclose($fp); 
    return str_replace("\r\n", "", $input); 

} 

echo("Whats your name? "); 
$name = read(); 
echo("Hello $name!\n");

?>

This was with the Win2K task manager. I just did a "run only once".

When the script calls reg.exe, is it using an absolute path to reg.exe or is it relying on it being in the same directory or in the path?

also if you have any registry key values with spaces in them, it will give reg.exe too many arguments. That's when you make sure the value is quoted when being passed to reg.exe. I doubt that's it because it works fine if you manually load the script.

Just throwing up a few ideas.;)
 
Oddly enough, I can't even get it to display a command window. I even tried executing it like this through Task Scheduler:
c:\windows\system32\cmd.exe /c "c:\php\php.exe c:\file.php"

I also included a little input prompt on mine this time, so the process just hangs. But I get no display! Any ideas on that?
 
can you successfully get the taskmanager to load say Winamp or some other program?

Or just cmd.exe by itself?

If it's just php, then the php install could be boogered up. I'm using 4.3.1. 4.3.4 did not work well with squirrelmail for me, so I stuck with 4.3.1. I have not tried 4.3.6 yet.
 
Back
Top