Friday, May 4, 2012

Disable Notice of Undefined Variable in WampServer

Yesterday I had to lose a couple of hours to solve a simple problem for my newly installed wamp server. When I tried to open my projects created using PHP in browser, they were looking good except a list of warnings. This warning is being displayed because of use of some variable that were not defined before. It was displaying something like this: "Notice: Undefined Variable in line 60". As, I cannot edit all of my projects' scripts, so I planned to disable this warning. But, I don't want to disable the other PHP error messages, only warnings/notices.

Found a simple and easy solution. It can be solved by replacing the line "error_reporting = E_ALL" by "error_reporting = E_ALL & ~E_NOTICE" at php.ini (php configuration file). But, after trying to edit a php.ini at "wamp/bin/php" I didn't see any changes. What happened, after some trial I got that, I am editing the wrong file. I should've edited php.ini from "wamp/bin/apache/Apache2.2.21/bin/". Edited that file and got the result at last. It's really confusing when there are multiple same files in different subfolders of a same root folder.

4 comments:

  1. Thanks a lot for your details information.

    ReplyDelete
  2. Thanks. Its really confusing. I have always been editing the php.ini file from the wamp icon tray and it has been working for me until I upgraded from wamp 1.7 to 2.0

    ReplyDelete
  3. Thanks it worked foe me. http://www.phptutorials.club

    ReplyDelete