Friday, May 4, 2012

PHP Coding Pro: Disable Notice of Undefined Variable in WampServer...

PHP Coding Pro: 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 cr...

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.