简体   繁体   中英

php WAMP setup - undefined variable error

What settings should be changed while setting up php WAMP so that undefined variable error are not encountered?

I changed the setting register_globals = on but it did not help.

Try a clean installation and be very careful not to not modify any part of the actual variable that might result in unsetting it. Just the settings part of the variable should be changed. Also, a bit more information might be helpful to us.

You are probably looking for this php.ini setting:

error_reporting = error_reporting = E_ALL & ~E_NOTICE 

it should be the default setting in a fresh install, though.

The best way, however, is always to change your scripts so undefined variable notices aren't thrown in the first place.

Notices sometimes contain valuable information that is impossible to find in a sea of meaningless "undefined variable" notices; and even if notices and warnings are suppressed, they slow down the script's execution! So the right thing is to prevent them from the start if at all possible.

You can check for the existence of each variable using isset() or empty() before using it to prevent undefined variable notices from happening.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM