[Mapserver-users] HELP! Bug in PHP 4.3.x ???

Dylan Keon keon at nacse.org
Thu Feb 20 00:34:46 EST 2003


Steve,

This is a known bug in 4.3.x.  Here's the workaround I'm using until 
they get it fixed (there are probably other ways to do this).  Put this 
near the top of your script.

///// Quick fix until the PHP guys fix $_SERVER['PHP_SELF'] /////
$_SERVER['SCRIPT_NAME'] = substr($_SERVER['PATH_TRANSLATED'], 
strlen($_SERVER['DOCUMENT_ROOT']));

if (substr($_SERVER['SCRIPT_NAME'], 0, 2) == '//') {
   $_SERVER['SCRIPT_NAME'] = substr($_SERVER['SCRIPT_NAME'], 1);
}

$PHP_SELF = $SCRIPT_NAME = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'];
/////////////////////////////////////////////////////////////////

--Dylan

-- 
************************************************
  Dylan Keon
  GIS/Database Research Specialist
  Northwest Alliance for Computational
  Science and Engineering (NACSE)
  Oregon State University
  Corvallis, OR 97331
  keon at nacse.org        (541) 737-6608
************************************************

woodbri at swoodbridge.com wrote:
> Hi all,
> 
> Has anyone run into this problem before or have any ideas on how to 
> fix it? This is either a bug or I'm doing something wrong that is not 
> obvious to me!
> 
> I built PHP 4.3.0 and PHP 4.3.1 on two different systems as CGI 
> modules for mapserver and the PHP_SELF variable is trashed!!!!!
> 
> It looks like there is an off by one bug as it has an extra character 
> in front of what should be the first character. Check out the 
> following link:
> 
> http://209.113.211.219/web2/info.php
> 
> You will notice that all the images are broken because the phpinfo() 
> function uses the value to reference itself and you can see it below 
> in the PHP variables:
> 
> PHP_SELF
> _SERVER["PHP_SELF"]
> 
> Here is how I configured it:
> 
> make clean
> rm -f config.cache
> ./configure \
> --enable-force-cgi-redirect \
> --enable-discard-path \
> --with-config-file-path=/etc/httpd/ \
> --with-gd=/usr/local \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --without-ttf \
> --with-pdflib \
> --with-mysql \
> --with-regex=system \
> --with-ming \
> --enable-dbase \
> --enable-dbx \
> --enable-versioning 
> 
> make
> cp sapi/cgi/php /var/www/cgi-bin/php
> make install
> 





More information about the mapserver-users mailing list