Practical Web Programming

Monday, August 04, 2008

PHP: How to Display Errors Without Tweaking the Configuration File

Displaying errors in your PHP applications by tweaking the configuration file is sometimes troublesome, especially for most beginners. Luckily, you don't have to get your hand dirty to deal with it.

After installing MAMP (Mac, Apache, MySQL, PHP) in my MacBook, I had a hard time debugging my PHP codes as MAMP's default configuration do not allow showing of error.

In production environment, showing errors is a big mistake you can commit as your website is more vulnerable to hack attacks. But in development environment such as localhost, showing errors save you a lot of time in debugging.

Here's what I did.


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


Put this two lines of codes in your index file and you'll see all the errors in your PHP codes will show off, if there are any (minus the links, of course).

4 comments:

gie said...

Welcome back... I am waiting you for a long time..

Pay Reviews said...

Dear Blogger,

We will pay your review in your blog;
* Earn cash by writing honest reviews about our advertiser's products and services.
* Write reviews in your own tone and style, and gear them to your audience's interest.
* You will be pay 6$ - $100 /reviews.
* Pays via Paypal

Join with us and start make money with your blog
www.smorty.com

KaTrInA said...

hi poh....im katrina from davao...nkita ko yung post mo na payroll system code....meron ka po bang code nun sa C#???final project ko kc ngayon...please reply poh..need ur help...

kabalweg said...

i'm sorry I don't have one. thanks for dropping by though. :)

Recent Post