Jump to content

Help With Error Reporting


punk_runner

Recommended Posts

I want to log my errors to a log file but it isn't working. I get the error displayed on the screen but the file is not written to. The file permissions are set to 777 to make things easy. Error reporting is on for development only. Any advice on why I cannot write to the file? It's an apache server.

 

Is there a trick to getting the file path correct relative to my front controller? Also, if I use error_log to send the error to my email address, it works.

 

 

ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', true);
error_log("You messed up!", 3, '/var/www/vhosts/domain.com/httpdocs/framework/errors.txt');

 

Link to comment
https://forums.phpfreaks.com/topic/223543-help-with-error-reporting/
Share on other sites

Hey wolf... they are in the same directory, www.domain.com/framework.

 

Eventually I will be changing where the error log is, to keep it out of public view, but for now I am just trying to get it working.

 

I've tried just setting it to 'errors.txt' since it is relative, but that didn't work either. File permissions are 777, CentOS Apache server.

Actually, now that I think of it...

 

The error_reporting and error_log block of code is in my front controller, which is in /framework with the errors.txt file, BUT the error is being thrown on /framework/application/controllers/router.class.php... so how do I write that to the correct file, which is /framework/errors.txt?

Okay, I got it working...

 

Number one, I had included my autoloader code before my error_log code, so the class that was causing an error was loading w/o any error_log directions... and I put the file as just '/errors.txt' as it is in the same directory as where my error_log code is.

 

Thanks for the input.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.