Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Web Hosting and Domains > Web Hosting Forum

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-07-2007, 11:36 PM
Senior Member
 
Join Date: Feb 2007
Posts: 110
Default Location of error log file?

I'm planning on setting up a cron job for each site on my reseller account to email me any errors that have occurred during that day. The trouble is I can't find the error log file. Does it exist in the directory structure I have access to or do I need to change the Raw Log Manager settings to create it?

Cheers!
Reply With Quote
  #2 (permalink)  
Old 03-08-2007, 12:01 PM
Administrator
 
Join Date: Mar 2006
Posts: 1,689
Default

Only rooot user has got access to error logs. Somee error logs related to your account are provided in the cpanel but you wont be able to fetch those using a script or cron as they are under ownership of cpanel.
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting
AIM : webredback || msn : andrew @ webhosting.uk.com
Toll Free : 0808 262 0855
Reply With Quote
  #3 (permalink)  
Old 03-08-2007, 12:52 PM
Senior Member
 
Join Date: Feb 2007
Posts: 110
Default

Ahh well, thanks for the info.
Reply With Quote
  #4 (permalink)  
Old 03-08-2007, 03:46 PM
Senior Member
 
Join Date: Feb 2007
Posts: 110
Default

I've figured out a work around using cURL. First create a file in your base directory (not your web directory since the script has passwords in it) e.g. /home/##username##/errorreport.php Add the following code to it, changing the bits starting and ending in ##:

Code:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_URL, '##AddressOfErrlog##');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, '##username##:##password##');
$content = curl_exec($ch);
curl_close($ch);

$pattern = '/\<pre\>(.*)\<\/pre\>/s';
preg_match($pattern, $content, $matches);

mail('##toemailaddress##', 'Errors', $matches[1]);
To find the ##AddressOfErrlog##, open cPanel then click on "Error log" then copy the url. Once that is created set up a Cron job to execute once per day the command: "php /home/##username##/errorreport.php". You can add as many sites as you want, just copy the code block and change the username, password and AddressOfErrlog to each site you want to report errors from.

Now sit back and check your mail each day to see if any of your sites are going pear shaped.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:13 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum