WampServer How To Fix PHP Error Notice: Undefined variable: index


4 Votes, Rating: 4.751 Star2 Stars3 Stars4 Stars5 Stars

Tags: , ,

How To Fix PHP Error Notice: Undefined variable: index

Today i have face this problem as listing below, and i have search a lot and try to fix my wamp server setting and waste my few professional hours. Im writing this so any other developer or designer not waste.

NOTE: This is just for those who wants to save their time to fix entire coding again to define variables. Otherwise i recommend must define variable before use them to avoid this error. 

this was the errors:

Notice: Undefined variable: q in in home.php on line 8

Notice: Undefined variable: module in home.php on line 11

you need to do some minor change on your php.ini file. please follow these steps

open your php.ini from wamp server and search “error_reporting = E_ALL & ~E_NOTICE

if that module not active, please active it.

and close (replace) 

error_reporting  =  E_ALL

to

;error_reporting  =  E_ALL

if any place.

——– 2nd step —— 

if you wont found this. only found

error_reporting = E_ALL

so replace that to

error_reporting = E_ALL & ~E_NOTICE

once you done please restarts your Apache server or “wamp” then go back to the page where you were getting this error and refresh the web page and you should not see this error anymore.

Warning: .htaccess/php.ini file can stop working your site if you use wrong code, USE ONLY AT YOUR OWN RISK!

Share/Save/Bookmark

8 Responses to “WampServer How To Fix PHP Error Notice: Undefined variable: index”

  1. salman says:

    if we disable this option error_reporting are we wont see any error massage from the php so its hard to find where is the error so what to do for that

  2. sam says:

    Thanks mate- saved some time figuring this problem out!

  3. WampServer How To Fix PHP Error Notice: Undefined variable ... says:

    WampServer How To Fix PHP Error Notice: Undefined variable ……

    [...]open your php.ini from wamp server and search “error_reporting = E_ALL … once you done please restarts your Apache server or “wamp” then go back to the page where …[...]…

  4. sumon says:

    if i define some thing like $myveriable and it is blank then show me undefine veriable how can it be fix

  5. Edgar says:

    thanks dude…I haven’t touch php in a long time and I was wondering why wamp was doing this…

  6. jinnna says:

    thanks buddy its working;;;;;;;;;;;;

  7. lionx says:

    thanks dude.. it really works! :)

  8. George says:

    i make this changes but stii have the error with undefined variable….i am running with WAMP…someone can help me?

Leave a Reply