Web Hosting Talk







View Full Version : PHP echo problem


AlaskanWolf
06-15-2002, 05:23 AM
We have a customer on FreeBSD and 4.2.1 PHP installed

Would anyone have any idea what is wrong with this


the problem is echo() doesnt work (IM NOT A PHP GUY) go off these two urls and u can see the 2nd one, doesnt post the info

http://www.stasik.com/test.php?var=you-should-see-this

http://www.psinetik.net/test.php?var=you-should-see-this

whats in each file

<?
echo $var;
?>


One thing i noticed is that my php file has alot more in terms of PHP Variables specially where it starts _ENV["XXXXX"]

his doesnt but have 2 lines of the ENV stuff

i am a
06-15-2002, 07:33 AM
php 4.2 + forces the $_GET and $_POST super global variables.

so while in pre 4.2, you can do this:

url: domain.com/?var=value

and get it like so:

echo $var;

in 4.2+, you would have to:

echo $_GET[var]

i think that's what you're talking about?

RutRow
06-15-2002, 09:24 AM
You can also edit your php.ini file and set

register_globals = On

to get PHP < 4.2.x behavior, but it is not recommended according to the notes inside the php.ini file.

xMattHawkx
06-15-2002, 11:45 AM
RutRow is correct, if the register global variable is set to off, you can't use the shortened variable names. You'll notice that if global variables is off HTTP_COOKIE_VARS/POST_VARS/GET_VARS/SERVER_VARS/ENV_VARS ect... will only work, while $var (a variable your client is creating at run time and filling with GET data, will not.

Simply turn on the register globals variable in php.ini to fix your problem.