External variables not working after migration to Linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

External variables not working after migration to Linux

Post by mikeb »

Hi,

One of my client's migrated the site we built for them to a Linux box (they are hosting their own site in-house). After the move (they would have set up LAMP) our GET variables are not being seen. I've ssh'd onto the server and looked at their php.ini file. Register_globals is set to 'off'. I've created two pages to test the theory. They won't run on the client's server but will run on my 'nix box

Here are the two simple pages:

Code: Select all

<html>
<head>
<title>What's wrong with the Get variables?</title>
<body>

click <a href="test_out.php?message=<? echo "Hello"; ?>">here</a> to send message!

</body>
</html>

Code: Select all

<html><head><title>did it work?</title></head>
<body>

the message today is, <?print $_GETї'message'];?>

</body>
</html>
Any insight appreciated,

cheers,

Mike
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

You sample code assumes that 'short_open_tag' is set to on. Is this the case within your clients php.ini file?
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

Post by mikeb »

Had a look at the php.ini (on the client's machine)

Code: Select all

; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
short_open_tag = On
Should I change my tags to long tags in my code?

cheers,

Mike
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

If the 'short_open_tag' directive is set to 'On' then you should have no need to switch to the long opening tag. Having said that, I always use the longer opening tag as I consider it to be more protable than using the short open tag.

Can you tell me, in your first example (test_in.php) is the 'message' variable being set with 'Hello' when you view the link properties? or is it just the GET variables that are not being picked up by the 'test_out.php' script?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm wondering what PHP version this LAMP installed..
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

Post by mikeb »

redmonkey
I always use the longer opening tag as I consider it to be more protable than using the short open tag
I think I'll move over to that idea anyway for future reference
is the 'message' variable being set with 'Hello'
Yes. I can see it in the status bar when I hover over the link and it remains in the address bar when I'm on the receiving page. To confirm, it is the GET variables which are not working (i.e. the variable is definitely going over to the receiving page).

feyd
what PHP version this LAMP installed
phpinfo reports version 4.6.0

thanks folks,

Mike
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

4.6.0 my eye.. 4.3.6 maybe.. :?
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

Post by mikeb »

DOH!

4.0.6

:oops:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's ancient. update it now. :D
Post Reply