server_port

Oliver Schulze L. oliver@samera.com.py
Wed, 27 Mar 2002 06:54:21 -0300


Hi,
I'm writing about the variable in /config/registry.php :
'server_port' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_PORT']
for the Horde application.

When I use an VirtualHostName in apache, the variable:
$GLOBALS['HTTP_SERVER_VARS']['SERVER_PORT']
always report the value 80, even if I'm using the port 81

Maybe this is a problem with my apache config, but a solution is using
the variable:
$GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST']

If I connecto to my server using port 81, I get:
HTTP_HOST=my.server.com:81
SERVER_PORT=80

This happen when I use the same VirtualHostName in apache
for 2 diferent ports:
<VirtualHost 192.168.1.1:80 192.168.1.1:81>
   ...
</VirtualHost>

So I need to parse the HTTP_HOST variable something like:
$var=$GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'];
$pos = strpos($var, ':');
if($pos)
  $port = substr($var, $pos+1);
else
  $port = 80;
echo "port: $port<br>";

Or use only one port :-)

Oliver

-- 
Oliver Schulze L.
oliver@samera.com.py
Asuncion-Paraguay