robb73 Posted March 29, 2007 Share Posted March 29, 2007 Newbie question, I have tried to set up the following custom error log function... (I'm working my way through the Visual Quickpro book on PHP & MySQL) error_log ($message, 1, $email, '[email protected]'); ...but I never receive the email. I have tested a PHP email form on the server which works - so I'm assuming PHP is set up for email sending. I have also tested the function by sending an error to a .txt file, which works fine. Is there a setting I should be looking at using phpinfo()? Any help much appreciated. Rob Link to comment https://forums.phpfreaks.com/topic/44799-error_log/ Share on other sites More sharing options...
per1os Posted March 29, 2007 Share Posted March 29, 2007 Where is the rest of the code for error_log ? Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-217519 Share on other sites More sharing options...
robb73 Posted March 29, 2007 Author Share Posted March 29, 2007 Sorry didn't think to post all the code :-\ <?php $live = TRUE; // Flag variable for site status: // Error log email address: $email = '[email protected]'; // Create the error handler. function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { global $live, $email; // Build the error message. $message = "An error occurred in script '$e_file' on line $e_line: $e_message\n"; // Append $e_vars to the $message. $message .= print_r ($e_vars, 1); if ($live) { // Don't show the error. // error_log ($message, 3, './err.txt'); error_log ($message, 1, $email, '[email protected]'); // Send email. echo '<div class="error">An error occurred.</div><br />'; } else { // Development (print the error). echo '<div class="error">' . $message . '</div><br />'; } } // End of my_error_handler() definition. // Use my error handler. set_error_handler ('my_error_handler'); ?> Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-217524 Share on other sites More sharing options...
per1os Posted March 29, 2007 Share Posted March 29, 2007 Did you change this: error_log ($message, 1, $email, '[email protected]'); to this: error_log ($message, 1, $email, '[email protected]'); where [email protected] is your actual email? Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-217532 Share on other sites More sharing options...
robb73 Posted March 29, 2007 Author Share Posted March 29, 2007 Yup, did that. Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-217548 Share on other sites More sharing options...
robb73 Posted March 30, 2007 Author Share Posted March 30, 2007 Is there anyway a hosting company can turn off / prevent this facility? Are there any server settings that might affect the error_log function? Rob Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-217972 Share on other sites More sharing options...
robb73 Posted March 30, 2007 Author Share Posted March 30, 2007 I contacted the hosting company and got the following explanation: "Having checked with our engineers I can confirm that the function for emailing the error_log is disabled on the shared hosting servers." Does anyone know if this is usual for shared hosting? Or, as I'm beginning to find a distinct lack of features with my current provider, should I change my hosting? My current provider is Fasthosts. Any recommendations appreciated. Rob Link to comment https://forums.phpfreaks.com/topic/44799-error_log/#findComment-218184 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.