Search Keyword:

13Jul

How to display PHP errors without altering php.ini file

Posted by admin as PHP

php_info

This quicktip will teach you on how display PHP errors on your website without altering your php.ini file and by just writing 2 lines of PHP code and including it in your config file or just including it into your page as an include file. Sometimes(or I say “always”) web hosting companies turn “display_errors” configuration to off by default and we don’t have access or cannot modify the php.ini file in our webhosting files. This is useful when you want to find some error that is bugging your pages but cannot see all the errors because of this default configuration set by your web hosting company.

You can put this code in a separate page and call them or you can just copy and paste these 2 lines of code to the pages where you need them.


ini_set('display_errors', 1);
error_reporting(E_ALL);

As a security measure always turn this off when you don’t need to debug anymore as error messages can be a tool for potential hackers when seen.

  • Digg
  • del.icio.us
  • Tumblr
  • StumbleUpon
  • Technorati
  • Reddit
  • NewsVine
  • Slashdot
  • DZone
  • Facebook
  • Twitter

Comment Form

Sponsored Links



Recent Comments

  • Alex13: Hi! thanks for this great post and code. I found a problem with it and need your help: I have in my form an...
  • Krishnakiran: Do anyone have a sample code for this
  • Paul: Nice, that is exactly what I was looking for, thanks!
  • Czek: can i use this with php uploads? my server does not support APC or Pecl upload progress..i need to provide user...
  • anup: thanx it helped me alot…