Jump to content

[SOLVED] Turn Off Advanced PHP Debugging


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.