EchoFool Posted October 30, 2008 Share Posted October 30, 2008 Hey, I was wondering if theres a way to prevent php syntax errors from displaying the page location fully? Like say it had: Parse error: syntax error, unexpected T_ELSE in /server/user/root/includes/connection.php on line 717 I want it to just say: Parse error: syntax error, unexpected T_ELSE in connection.php on line 717 That way users have less oppotunity if an error occurs to see the directory structure of my files? Whilst at the same time the error is helpful for me to find the problem quickly cos i know where my php file names are, no two have the same name anyway. Hope you can help. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/ Share on other sites More sharing options...
wildteen88 Posted October 30, 2008 Share Posted October 30, 2008 It is recommended to turn display_errors off on live servers. Instead you should opt to log errors to an external file. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678730 Share on other sites More sharing options...
Maq Posted October 30, 2008 Share Posted October 30, 2008 It's in your php.ini file. It's the display_errors attribute, i believe it should be set to 0 for it not to display errors. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678731 Share on other sites More sharing options...
EchoFool Posted October 30, 2008 Author Share Posted October 30, 2008 So will all errors naturally go to the server error log even if i dont have it displaying the errors? Does this include notices or just full warnings? Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678733 Share on other sites More sharing options...
wildteen88 Posted October 30, 2008 Share Posted October 30, 2008 The typeof errors logged is controlled by the error_reporting level. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678734 Share on other sites More sharing options...
EchoFool Posted October 30, 2008 Author Share Posted October 30, 2008 Where do i set that too ? Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678736 Share on other sites More sharing options...
wildteen88 Posted October 30, 2008 Share Posted October 30, 2008 The main place would be your php.ini or you can set it during runtime in your PHP script. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678738 Share on other sites More sharing options...
EchoFool Posted October 30, 2008 Author Share Posted October 30, 2008 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678748 Share on other sites More sharing options...
Maq Posted October 30, 2008 Share Posted October 30, 2008 For example, if you want to temporarily set errors to display on your page for debugging and whatnot, you could put at the top of your script: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678899 Share on other sites More sharing options...
PFMaBiSmAd Posted October 30, 2008 Share Posted October 30, 2008 I recommend always having error_reporting set to E_ALL so that things like visitors searching for terms that contain unexpected values that cause errors or more seriously hackers feeding your code unexpected data to break into your script, will show up in your error log so that you have a record of any problems that are occurring. Quote Link to comment https://forums.phpfreaks.com/topic/130776-solved-error-reporting-control/#findComment-678903 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.