tazmaniac Posted March 15, 2006 Share Posted March 15, 2006 Hello,i have a weird problem. I am trying to write some code and try it out on my pc. Where i installed php4 and mysql.The thing is that i keep getting errors when i try to output the code:Notice: Undefined variable: common in c:\inetpub\wwwroot\magazijn\test2.php on line 12Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\magazijn\test2.php on line 67The weird thing is that when i run the php file on the server of my hosting i dont get those errors!My guess is, it has something to do with the php.ini file.But in a million years, i got no id of what i have to change.Maybe you guys can help me out???? :-)thnx in advance!greetzTaz Quote Link to comment https://forums.phpfreaks.com/topic/5039-keep-getting-errors-but-not-on-other-servers-s/ Share on other sites More sharing options...
wildteen88 Posted March 15, 2006 Share Posted March 15, 2006 If you're using varibaled like $PHP_SELF then it looks like you other sever has the dreded register_globals turn On and your local server install on your pc has this directive turned Off!Having register globals off is recommend as when its on it can open up big securiity holes within your script. As you can set variables anywhere and php will use then, where as having it Off doesn't just create any old variables.So if you had a form on form.php and you where submitting the form to send.php then I can just go to send.php and enter what I liked after send.php such as send.php?var1=somethingnasty and if you used var1 in your code php will use what ever is set in the url! When register_globals is off you use special variables called superglobal arrays. Quote Link to comment https://forums.phpfreaks.com/topic/5039-keep-getting-errors-but-not-on-other-servers-s/#findComment-17818 Share on other sites More sharing options...
obsidian Posted March 15, 2006 Share Posted March 15, 2006 since you mention the $PHP_SELF variable, it makes me wonder if your host has register_globals turned ON and you have it set to OFF on your PC. the preferred flag is definitely OFF, but you would have to modify your code to allow for that. for instance, instead of simply using $PHP_SELF, you should use $_SERVER['PHP_SELF'].hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/5039-keep-getting-errors-but-not-on-other-servers-s/#findComment-17819 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.