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

woodbri at swoodbridge.com woodbri at swoodbridge.com
Thu Feb 20 04:54:36 PST 2003


Thanks Dylan.

Arrrgh! You would think that they would just fix it! This has got to 
break 90-100% of the applications written in PHP. And changing every 
script ( and not forgetting some ) is a pain if not impossible.

Maybe this can get put in an auto prepend file....

-Steve


On 19 Feb 2003 at 21:34, Dylan Keon wrote:

> 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