View previous topic :: View next topic |
Author |
Message |
pyro -
Joined: 28 Feb 2003 Posts: 6
|
Posted: Fri Feb 28, 2003 2:20 am Post subject: Server Variables... |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Feb 28, 2003 11:49 pm Post subject: Re: Server Variables... |
|
|
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 |
|
|
pyro -
Joined: 28 Feb 2003 Posts: 6
|
Posted: Fri Feb 28, 2003 11:55 pm Post subject: Re: Server Variables... |
|
|
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 |
|
|
datwig -
Joined: 26 Jan 2003 Posts: 85
|
Posted: Sat Mar 01, 2003 12:47 am Post subject: Err? |
|
|
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 |
|
|
pyro -
Joined: 28 Feb 2003 Posts: 6
|
Posted: Sat Mar 01, 2003 12:51 am Post subject: |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Mar 03, 2003 1:46 am Post subject: |
|
|
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 |
|
|
pyro -
Joined: 28 Feb 2003 Posts: 6
|
Posted: Mon Mar 03, 2003 2:17 am Post subject: |
|
|
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 |
|
|
|