Beasts Posted January 17, 2010 Share Posted January 17, 2010 hello, i dont know if this is the right section to post this or not, but is there way to change log the PHP errors into a custom file using .htaccess? Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 In the same way that you just globally set the session save path in a .htaccess file, you can set the error_log setting as well. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996425 Share on other sites More sharing options...
Beasts Posted January 17, 2010 Author Share Posted January 17, 2010 umm okay O_O php_value error_log /error_log.log so it would be like that? /edit: just tried. no errors are being logged. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996428 Share on other sites More sharing options...
trq Posted January 17, 2010 Share Posted January 17, 2010 Does the file exist and is it writable by the user the web server is executing as? Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996433 Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 error_reporting must also be set to E_ALL and log_errors must be ON. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996437 Share on other sites More sharing options...
Beasts Posted January 17, 2010 Author Share Posted January 17, 2010 the file does exist and its right now 644. i tried as 777 too but no luck. and yes i set log_errors on and error_reporting is also set Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996439 Share on other sites More sharing options...
trq Posted January 17, 2010 Share Posted January 17, 2010 644 will likely be no good, 666 however should be sufficient (its doesn't need to be executable). Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996444 Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 Also, a leading slash in the file path refers to the root of the current hard disk. I seriously doubt that you have access to that path. You likely need to use a path that is somewhere within your accounts folder tree. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996449 Share on other sites More sharing options...
Beasts Posted January 17, 2010 Author Share Posted January 17, 2010 666 and still no errors. without the forward slash it would mean the log file is in the same location as the .htaccess file right? i already tried that and no errors logged that way either O_O Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996453 Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 Umm. The PHP constant E_ALL has no meaning in a .htaccess file. You need to use the corresponding numeric value. Using -1 will (should) cause all of the error_reporting bits to be set. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996457 Share on other sites More sharing options...
trq Posted January 17, 2010 Share Posted January 17, 2010 without the forward slash it would mean the log file is in the same location as the .htaccess file right? You likely need to provide the complete path to the file. It'll be something like.... /home/<yourusername>/public_html or /var/www/<yourusername> You can find the full path to your document root using by echo $_SERVER['DOCUMENT_ROOT'] in php. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996459 Share on other sites More sharing options...
Beasts Posted January 17, 2010 Author Share Posted January 17, 2010 i was using 999999 (and more 9's) . i'l try with -1. /update: still a blank log file =/ Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996461 Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 Show us the actual lines you are using in the file (are you sure the session save path setting you put into the .htaccess file is actually working?) Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996462 Share on other sites More sharing options...
Beasts Posted January 17, 2010 Author Share Posted January 17, 2010 provided full path to the log file and now its logging. is there anyway to do it in a more shorthand way? i mean the full path is really long? is there another way to do it using relative paths or something like that? Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996463 Share on other sites More sharing options...
trq Posted January 17, 2010 Share Posted January 17, 2010 provided full path to the log file and now its logging. is there anyway to do it in a more shorthand way? i mean the full path is really long? is there another way to do it using relative paths or something like that? I don't think so. Whats it matter? Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-996475 Share on other sites More sharing options...
steviewdr Posted January 19, 2010 Share Posted January 19, 2010 Perhaps Allow Overwrite All is required in your apache conf to allow you to use .htaccess files in that folder. Link to comment https://forums.phpfreaks.com/topic/188757-error-logging/#findComment-998288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.