Brinn Posted December 11, 2008 Share Posted December 11, 2008 I have a server that I am setting up ad a development server. I have a problem though. All my old scripts are giving me a errors. I understand why they are, and I am sure I can turn them off, but I don't know how. I am used to checking to see if a variable is set in order to do something. If it is there do something, if it isn't set then it doesn't. However, I am getting error codes when I check to see if that is variable is set. For example, I have this code here: if ($_SERVER['HTTPS'] == "on") { $prefix = "https://"; } else { $prefix = "http://"; } I get this error code: Notice: Undefined index: HTTPS in [[filename]] on line 15 How can I turn these notices off? I did google search it and didn't come up with anything helpful. However, if you know of any links with this problem please let me know. Kyle Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2008 Share Posted December 11, 2008 Use isset() or empty() to check variables that might not exist at runtime. Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/#findComment-712480 Share on other sites More sharing options...
Mchl Posted December 11, 2008 Share Posted December 11, 2008 Disable error_reporting for E_NOTICE Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/#findComment-712485 Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2008 Share Posted December 11, 2008 Only the display_errors setting should be set to OFF on a live server. Changing the error_reporting setting prevents logging of unexpected problems in the script, such as a legitimate visitor entering a search term that your validation logic does not handle correctly or a hacker probing your script in an attempt to exploit it. Code should not generate any errors as it executes normally, only for unexpected conditions. A variable that might not exist at runtime is not an unexpected condition and should be fixed instead of being masked as the act of masking it will mask other problems as well. Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/#findComment-712503 Share on other sites More sharing options...
Brinn Posted December 11, 2008 Author Share Posted December 11, 2008 Thanks everything this helped allot! I now have my test server running as well as the live site. Mchl solution helped me! Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/#findComment-712551 Share on other sites More sharing options...
Mchl Posted December 11, 2008 Share Posted December 11, 2008 Thanks everything this helped allot! I now have my test server running as well as the live site. Mchl solution helped me! Thanks again. Mind you, that you really should take PFMaBiSmAd's advice into consideration Quote Link to comment https://forums.phpfreaks.com/topic/136501-solved-turn-off-advanced-php-debugging/#findComment-712582 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.