Forum Moderators: travelin cat

Message Too Old, No Replies

Problem with php (or apache) on my G5

         

rennat

4:53 am on Jul 19, 2005 (gmt 0)



I use "web sharing" to test my PHP instead of uploading after every change. Here is a problem I have had since I got my G5.

the server (php or apache I'm not sure) will not recognize variables sent in the URL (not sure of the correct name.) like:

index.php?var=foo

On my old system and when I upload to my server it creates a variable called $var and give it "foo" for a value.

on my current server if index.php contained

echo $var;

it would not print anything, in fact it thinks the variable doesn't exist.

does anyone know what could be causing this? or has anyone else had a similar problem? this has happened on two separate G5's now. (mine and a friends)

thank you for your time.

-oh and i did turn on PHP, things like includes or anything not involving a sent variable works-

BjarneDM

6:00 am on Jul 19, 2005 (gmt 0)

10+ Year Member



register_globals is set to off on Mac OS X while they are on on your old system.
Take a look in your php.ini files.

Having register_globals set to on is considered a serious security risk.
For a discussion see here [dk2.php.net...]

timster

12:05 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Short answer:

echo $_GET['var'];

zgarside

4:28 pm on Jul 20, 2005 (gmt 0)



The easiest way to fix the problem is to include the following line of code at the top of the script for each variable you are expecting:

$varname = $_GET['varname'];

If the variables are coming from a form instead of in the query string use the following instead:

$varname = $_POST['varname'];

To be safe, you should include some data validation code to be safe (preventing malicious users from sending PHP code as variables).