Jump to content


Photo

Keep getting errors ... but not on other servers :-s


  • Please log in to reply
2 replies to this topic

#1 tazmaniac

tazmaniac
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 March 2006 - 02:08 PM

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 12
Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\magazijn\test2.php on line 67

The 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!

greetz

Taz

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 March 2006 - 02:16 PM

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.

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 15 March 2006 - 02:16 PM

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
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users