Page 1 of 1

cron-job run PHP and file opening

Posted: Fri May 02, 2008 2:18 am
by LonelyProgrammer
Hi,

I am using crontab (in cpanel) to run a php script. For some reasons, I cannot seem to open any file from within the php script (the same code works fine if I just run it straight without cron). What could be reasons? What can I do?

Thanks!

Re: cron-job run PHP and file opening

Posted: Fri May 02, 2008 4:14 am
by youscript
Maybe some problem about the path of the file,
You can display the error in your script when open the file, post the error or your code here.

Re: cron-job run PHP and file opening

Posted: Fri May 02, 2008 12:35 pm
by LonelyProgrammer
This is the email sent by the CRON Daemon:
X-Powered-By: PHP/5.2.5
Set-Cookie: PHPSESSID=894b3895ad6900e39f90c060552ab6b5; path=/
Expires: Mon, 20 Dec 1998 01:00:00 GMT
Last-Modified: Fri, 02 May 2008 07:15:03 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Content-type: text/html

<br />
<b>Warning</b>: fopen(./log/ipnlog.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home/domainname/public_html/vfpp_ipn/credits/php/util/PHPLogger.php</b> on line <b>43</b><br />
Failed to obtain a handle to log file 'ipnlog.txt'<br />
<b>Warning</b>: fopen(./log/warnings_05-02-08.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home/domainname/public_html/vfpp_ipn/credits/php/util/PHPLogger.php</b> on line <b>50</b><br />
Failed to obtain a handle to warning log file './log/warnings_05-02-08.txt'<br />
<b>Warning</b>: fopen(./log/errors.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home/domainname/public_html/vfpp_ipn/credits/php/util/PHPLogger.php</b> on line <b>56</b><br />
Failed to obtain a handle to error log file './log/errors.txt'CRON job activated at :1209712503
It has failed to open a file handle - it has to be mentioned this code, if run directly without using CRON to invoke it, works. Is there any other method for me to output to a file besides fopen?