Turning on display_errors in WAMP – Video Tutorial

PHP Video Tutorial

Hi,

Within a WAMP installation, I ran into a little issue today when trying to change php.ini’s ‘display_errors’ property.

By default WAMP installs with ‘display_errors’ to ‘Off’:

display_errors = Off

… This is a pain-in-the-ass setting when trying to write new PHP code because errors don’t get displayed in the browser window; you have to go to the log file.

So like any good nerd, I popped open php.ini and made the change:

display_errors = On

Problem is that it didn’t work. I soon discovered that WAMP was using ANOTHER php.ini file on my machine!

Solution:

Run phpinfo() and look for the property: ‘Loaded Configuration File’

This will tell you what php.ini WAMP is using.

-

I created a video (with more details on WAMP and php.ini) for those who like to watch.

Thanks,

Stefan Mischook

www.killerphp.com


This entry was posted on Thursday, August 30th, 2007 at 3:57 pm and is filed under Beginners PHP Articles. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

5 Responses to “Turning on display_errors in WAMP – Video Tutorial”

  1. Stefan Mischook’s Blog: Turning on display_errors in WAMP – Video Tutorial…

  2. [...] Stefan Mischook has posted another video tutorial to help developers get started in their PHP travels. This time it covers how to turn on errors when using the popular WAMP installation package. Within a WAMP installation, I ran into a little issue today when trying to change php.ini’s ‘display_errors’ property. By default WAMP installs with ‘display_errors’ to ‘Off’ – This is a pain-in-the-ass setting when trying to write new PHP code because errors don’t get displayed in the browser window [...]

  3. Good cast.

    I think it’s important to mention that display_errors should only be set to ‘on’ under development servers and should always be ‘off’ under production.

    Also, display_errors will not show parse errors by default. If you want PHP to render parse errors on your development server, you’ll need to set the error_reporting directive to an appropriate level.

    I personally find it easier to leave them both set to the default, secure setting as they are shipped with PHP. When in development, I include a ‘development.php’ file which has the following content.

    Cheers,
    Mike G.

  4. I guess you set wordpress to not render anything within brackets… The content for the file is as follows:

    ini_set(‘display_errors’, ‘on’);
    error_reporting(E_ALL);

  5. Stefan Mischook says:

    “I think it’s important to mention that display_errors should only be set to ‘on’ under development servers and should always be ‘off’ under production.”

    Agreed.

Created By Stefan Mischook  |  Top of page  go to top of page