PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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:
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...
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.
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?