Page 1 of 1

Weird CLI issue

Posted: Fri Apr 15, 2005 11:06 am
by Burrito
I have a cron job set up to run a report every hour on my phonelog system here but for some reason my php page isn't working from the CLI. I get an error like this:

Code: Select all

Warning: fopen(logs/all-tday.php): failed to open stream: No such file or direct
ory in w:\inetpub\wwwroot\phonesys\report.php on line 157

Warning: fwrite(): supplied argument is not a valid stream resource in w:\inetpu
b\wwwroot\phonesys\report.php on line 158

Warning: fclose(): supplied argument is not a valid stream resource in w:\inetpu
b\wwwroot\phonesys\report.php on line 159
the weird thing is, if I run that same page from a web interface, it loads up just perfectly with no errors. It's almost like my relative paths get busted from the CLI, but they remain in tact from the web interface. I have done this exact same thing on another machine and not had problems, but for some reason, it just dies here...

any suggestions?

Posted: Fri Apr 15, 2005 11:08 am
by feyd
make sure the file is being run from the correct start up directory..

Posted: Fri Apr 15, 2005 11:08 am
by Bennettman
You could try using an absolute path or a URL path.

Posted: Fri Apr 15, 2005 11:51 am
by Chris Corbyn
Me thinks this is a sceurity policy issue :wink:

Posted: Fri Apr 15, 2005 12:38 pm
by Burrito
ok, I just looked at the other machine to see if I could see a difference between how they are set up and as far as I can see they are identical.

I do remember this however: when I set the first machine up initally I used the php installer (so it installed with cgi) I then (after the fact) set it up with isapi for the web part. could it be that the initial install (using the installer) initiated somethign different for the cgi (php.exe) that would make it run differently from the CLI than what I did with the new one (straight isapi from the beginning)?

that's the only thing I can think of at thsi point.

Posted: Fri Apr 15, 2005 1:41 pm
by Burrito
well Feyd helped me out by having me run getcwd() from both the cli and the web interface and we determined that it was a different folder location for the two.

Bennet your suggestion was right on and changing it to an absolute path fixed the problem.

I'm still at a loss as to why it would work on the other system though as it's virutally the same.

why would the cwd be the location of the file on the old system, but not the new?

my interest is peaked....anyone know?