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!
cron-job run PHP and file opening
Moderator: General Moderators
-
LonelyProgrammer
- Forum Contributor
- Posts: 108
- Joined: Sun Oct 12, 2003 7:10 am
Re: cron-job run PHP and file opening
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.
You can display the error in your script when open the file, post the error or your code here.
-
LonelyProgrammer
- Forum Contributor
- Posts: 108
- Joined: Sun Oct 12, 2003 7:10 am
Re: cron-job run PHP and file opening
This is the email sent by the CRON Daemon:
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?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