Friday 15 March 2013

PHP production server - turn on error messages -


This question has previously been said in general terms. I want to display an error message on a particular page on my production server, and I do not have access to the php.ini file.

I have tried ERROR_REPORTING (E_ALL); .

To enable errors, you should use before those points where they are triggered (for example, the script at the beginning of your PHP) :

 < Code> error_reporting (E_ALL);  

and the displayed error is, you should configure:

  ini_set ('display_errors', 'on');  

(This should be disabled on a production server, which means that you may still be able to error_reporting ) after configuring it.


Of course, if all this can be explained in a if block, to ensure that you can only see error messages - especially if you do It's on a live production website; For example:

  if ($ _SESSION ['is_admin']) {error_reporting (E_ALL); Ini_set ('display_errors', 'on'); }  


And to make things a bit pretty, you can also configure:

  ini_set ('html_errors', 'on' );  

No comments:

Post a Comment