php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13962 Problem with Environment Variables
Submitted: 2001-11-06 17:16 UTC Modified: 2003-09-02 18:24 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: wburnett at cyberenv dot net Assigned:
Status: Not a bug Package: iPlanet related
PHP Version: 4.0.6 OS: Solaris 8
Private report: No CVE-ID: None
 [2001-11-06 17:16 UTC] wburnett at cyberenv dot net
After installing PHP on two different Solaris boxes.  I have found a problem I just can't find a resolve to.
One box is iPlanet Enterprise 4.1
Other is is iPlanet Enterprise 6.0


Some of the PHP scripts I'm using use the web servers environment variables.  Because the iPlanet web server also uses an ADMIN port for configuration.  The environment variables are reporting the admin port instead of the normal http port 80 where the working web server resides.

If I use a <?phpinfo()?> script.  I get the following results reported.


    HTTP_HOST box1.myhost.com:8808
    HTTP_REFERER http://box1.myhost.com:8808/https-box1.myhost.com/bin/commit
    SERVER_PORT  8808
    SERVER_URL  http://box1.myhost.com:8808
    etc...

The port reported is my admin port not the web server port of 80.

Everything else seems to function perfectly

I have been researching this problem for two weeks now and still haven't come any closer to the fix.
Could anyone please clue me in!

Thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 20:47 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2003-09-01 23:26 UTC] sorry at nospam dot org
i have a similar problem w/ sun one iplanet 6 sp5 the http_host variable has the iplanet's admin port strung to it. i think this is one reason phpmyadmin isn't working for me... i'm on solaris 9 ad using php 4.3.3 w/ phpmyadmin 2.5.2 pl1
 [2003-09-02 08:42 UTC] sniper@php.net
These variables are set to whatever iPlanet tells they are.

 [2003-09-02 10:28 UTC] thetaphi@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This behavior is exspected, because iPlanet is a multithreaded webserver. You cannot use the environment to get CGI variables. Use $_SERVER['HTTP_HOST'] etc.! $_ENV['HTTP_HOST']/getenv('HTTP_HOST') will get the environment of the webserver process. That's correct. 
If you want to use register_globals on try setting the correct variable order to get the server variables first!
 [2003-09-02 18:24 UTC] thetaphi@php.net
Additionally: why do you see CGI-like variables from the admin server?
Answer: This is because you started the webserver process from the admin server which runs the startup script of the webserver you wanted to start as a cgi script (a cgi script inside of the admin server!!!). This is why the environment of the started webserver has some CGI environment variables in it, because it got started by a CGI.
You can test this by starting the webserver not from the administration server. Use the unix command line as root and start it manually - you will see there are no CGI-like environment variables.
In multithreaded webservers the only possibility to get the CGI variables ist by using $_SERVER[]. Please change your scripts to use that. $_ENV[]/getenv() is useless!
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 16:01:25 2019 UTC