Server Variables...

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
pyro
-


Joined: 28 Feb 2003
Posts: 6

PostPosted: Fri Feb 28, 2003 2:20 am    Post subject: Server Variables... Reply with quote

Do I need to do something special to make server variables work?

Code:
<?PHP
echo $REMOTE_ADDR;
?>

etc. won't work on my server. It is set up at http://localhost:81/ to be a testing server...
_________________
http://www.infinitypages.com/
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Feb 28, 2003 11:49 pm    Post subject: Re: Server Variables... Reply with quote

pyro wrote:
Do I need to do something special to make server variables work?

Code:
<?PHP
echo $REMOTE_ADDR;
?>

etc. won't work on my server. It is set up at http://localhost:81/ to be a testing server...

This is a PHP issue. Use $_SERVER['REMOTE_ADDR'] instead.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
pyro
-


Joined: 28 Feb 2003
Posts: 6

PostPosted: Fri Feb 28, 2003 11:55 pm    Post subject: Re: Server Variables... Reply with quote

aprelium wrote:
This is a PHP issue. Use $_SERVER['REMOTE_ADDR'] instead.
So it can be fixed in php.ini?
_________________
http://www.infinitypages.com/
Back to top View user's profile Send private message Visit poster's website
datwig
-


Joined: 26 Jan 2003
Posts: 85

PostPosted: Sat Mar 01, 2003 12:47 am    Post subject: Err? Reply with quote

Remote address? Doesn't that mean the viewer's IP? If so, then this is another (harder) way to show it:
Code:
<?
$ip=getenv("REMOTE_ADDR");

echo $ip;

?>

Easier? Or harder?
Back to top View user's profile Send private message AIM Address
pyro
-


Joined: 28 Feb 2003
Posts: 6

PostPosted: Sat Mar 01, 2003 12:51 am    Post subject: Reply with quote

It's not just the remote address, it is also variables like $DOCUMENT_ROOT, etc. Basically, most of my PHP files are not working, because I use these variables...
_________________
http://www.infinitypages.com/
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Mar 03, 2003 1:46 am    Post subject: Reply with quote

pyro wrote:
It's not just the remote address, it is also variables like $DOCUMENT_ROOT, etc. Basically, most of my PHP files are not working, because I use these variables...

PLease refer to the PHP documentation. It clearly states that starting from version 4.2, those variables must be accessed using for example $_SERVER['variable'] .
If you have old scripts and need backward compatibility, edit php.ini and set register_globals to on
Code:

register_globals=on

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
pyro
-


Joined: 28 Feb 2003
Posts: 6

PostPosted: Mon Mar 03, 2003 2:17 am    Post subject: Reply with quote

Oddly enought, register_globals _is_ on... Don't really know what is throwing out these errors. Luckily $_SERVER['VARIABLE'] seems to be working, so maybe I should just convert my scripts to that. It's how it's supposed to be done anyway. :lol:
_________________
http://www.infinitypages.com/
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group