Skip to content

RedHat8AndMapserver37

Thomas Bonfort edited this page Apr 6, 2012 · 2 revisions

== Known Problems ==

17 March 2004                                                                                                                                                                                                                 

A solution to the problem below is to edit php.ini:

 # cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's                                                                                                                                             
 # previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok                                                                                                                                              
 # what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting                                                                                                                                             
 # this to 1 will cause PHP CGI to fix it's paths to conform to the spec.  A setting                                                                                                                                              
 # of zero causes PHP to behave as before.  Default is zero.  You should fix your scripts                                                                                                                                         
 # to use SCRIPT_FILENAME rather than PATH_TRANSLATED.                                                                                                                                                                            
 cgi.fix_pathinfo = 1                                                                                                                                                                                                             
27 June 2003                                                                                                                                                                                                                  
                                                                                                                                                                                                                              
      o Sometimes when compiling PHP with the ./configure options outlined below (particularly the --enable-discard-path), a problem arises with PHP. When you run phpinfo() PHP produces error's like:                       
                                                                                                                                                                                                                              
     **Warning: Unexpected character in input: '' (ASCII=24) state=1 in                                                                                                                                                       
     **/var/www/cgi-bin/php on line 686                                                                                                                                                                                       
                                                                                                                                                                                                                              
     ***Warning: Unexpected character in input: '' (ASCII=8) state=1 in                                                                                                                                                       
     ***/var/www/cgi-bin/php on line 686                                                                                                                                                                                      
     ***...                                                                                                                                                                                                                   
     ***Parse error: parse error in /usr/local/apache/cgi-bin/php                                                                                                                                                             
                                                                                                                                                                                                                              
     As a work around to this problem you can compile PHP without the --enable-discard-path option and it seems to work fine. Please be aware                                                                                 
     that this option provides the following functionality and leaving this option from the configure string disables this:                                                                                                   
                                                                                                                                                                                                                              
     --enable-discard-path   If this is enabled, the PHP CGI binary can safely be placed outside of the web tree and people                                                                                                   
     will not be able to circumvent .htaccess security."                                                                                                                                                                      
                                                                                                                                                                                                                              
06 APR 2003                                                                                                                                                                                                                   
                                                                                                                                                                                                                              
      o There appears to be a problem with threads. gc                                                                                                                                                                        
      o The PHP-4.3.0 bug appears to be fixed in 4.3.2RC1. I've not checked for a later version (yet). gc                                                                                                                     
                                                                                                                                                                                                                              
20 Feb 2003                                                                                                                                                                                                                   
                                                                                                                                                                                                                              
      o There is a problem that PHP/Mapscript? process does not terminate or take a long time to terminate. - no work around at this time                                                                                     
      o If you are using OUTPUTFORMAT descriptions, you need to have an IMAGETYPE <type> command in your mapfile or it will select some internal default - probably not what you want. This should change shortly in CVS.     
      o PHP-4.3.0 has a serious security issue, you should use PHP-4.3.1                                                                                                                                                      
      o PHP-4.3.x built as a CGI module (required for mapscript) has a bug that causes PHP_SELF to get clobbered. This should be fixed in CVS and PHP-4.3.2. I fixed this by creating an auto_prepend.php file the contained: 
<?php                                                                                                                                                                                                                             
///// 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'];                                                                                                                                                                                                          
/////////////////////////////////////////////////////////////////                                                                                                                                                                 
?>                                                                                                                                                                                                                                

== Build Notes ==

# Here are my build notes for installing Mapserver et al on RH 8.0                                                                                                                                                                
# many thanks to Vincent Schut for his build notes                                                                                                                                                                                
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                  
# removed these and dependent rpms                                                                                                                                                                                                
  rpm -e gd                                                                                                                                                                                                                       
  rpm -e curl-7.9.8-1                                                                                                                                                                                                             
  rpm -e curl-devel-7.9.8-1                                                                                                                                                                                                       
  rpm -e php                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
# already have rpm installed                                                                                                                                                                                                      
  rpm -q libpng-1.2.2-8                                                                                                                                                                                                           
  rpm -q libpng-devel-1.2.2-8                                                                                                                                                                                                     
  rpm -q libjpeg-6b-21                                                                                                                                                                                                            
  rpm -q libjpeg-devel-6b-21                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
# installed                                                                                                                                                                                                                       
  rpm -i pdflib-4.0.1-1.i386.rpm                                                                                                                                                                                                  
                                                                                                                                                                                                                                  
# download and build ming                                                                                                                                                                                                         
tar xzf ming-0.2a.tgz                                                                                                                                                                                                             
cd ming-0.2a                                                                                                                                                                                                                      
make                                                                                                                                                                                                                              
make static                                                                                                                                                                                                                       
make install                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
# download and build curl                                                                                                                                                                                                         
tar xzf curl-7.10.3.tar.gz                                                                                                                                                                                                        
cd curl-7.10.3                                                                                                                                                                                                                    
./configure                                                                                                                                                                                                                       
make                                                                                                                                                                                                                              
make install                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
# add /usr/local/lib to /etc/ld.so.conf                                                                                                                                                                                           
/sbin/ldconfig                                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
# download and install gd-2 into /usr/local                                                                                                                                                                                       
rm -f /usr/lib/libgd.*     # to remove any potentially conflicts                                                                                                                                                                  
tar xzf gd-2.0.11.tar.gz                                                                                                                                                                                                          
cd gd-2.0.11                                                                                                                                                                                                                      
./configure                                                                                                                                                                                                                       
make                                                                                                                                                                                                                              
make install                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
# download and install gdal-1.1.8                                                                                                                                                                                                 
tar xzf gdal-1.1.8.tar.gz                                                                                                                                                                                                         
cd gdal-1.1.8                                                                                                                                                                                                                     
./configure \                                                                                                                                                                                                                     
  --with-libz \                                                                                                                                                                                                                   
  --with-png \                                                                                                                                                                                                                    
  --with-libtiff=internal \                                                                                                                                                                                                       
  --with-geotiff=internal \                                                                                                                                                                                                       
  --with-jpeg \                                                                                                                                                                                                                   
  --without-jasper \                                                                                                                                                                                                              
  --without-python                                                                                                                                                                                                                
make                                                                                                                                                                                                                              
make ogr-all                                                                                                                                                                                                                      
make install                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
/sbin/ldconfig                                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
# download and build php-4.3.0                                                                                                                                                                                                    
tar xzf php-4.3.0.tar.gz                                                                                                                                                                                                          
cd php-4.3.0                                                                                                                                                                                                                      
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                                                                                                                                                                                                  
make install                                                                                                                                                                                                                      
cp php.ini-dist /etc/httpd/php.ini                                                                                                                                                                                                
# change the following as appropriate                                                                                                                                                                                             
diff /etc/httpd/php.ini php.ini-dist                                                                                                                                                                                              
423c423                                                                                                                                                                                                                           
< extension_dir = /etc/httpd/php_mods                                                                                                                                                                                             
---                                                                                                                                                                                                                               
> extension_dir = ./                                                                                                                                                                                                              
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                  
# download and build proj libraries                                                                                                                                                                                               
tar xzf proj-4.4.5.tar.gz                                                                                                                                                                                                         
cd proj-4.4.5/nad                                                                                                                                                                                                                 
tar xzf ../../proj-nad27-1.1.tar.gz                                                                                                                                                                                               
cd ..                                                                                                                                                                                                                             
./configure                                                                                                                                                                                                                       
make                                                                                                                                                                                                                              
make install                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
/sbin/ldconfig                                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                  
# download and build mapserver-3.7                                                                                                                                                                                                
                                                                                                                                                                                                                                  
tar xzf mapserver-3.7.tgz                                                                                                                                                                                                         
cd mapServer-3.7                                                                                                                                                                                                                  
rm -f config.cache                                                                                                                                                                                                                
./configure \                                                                                                                                                                                                                     
  --without-tiff \                                                                                                                                                                                                                
  --without-eppl \                                                                                                                                                                                                                
  --without-jpeg \                                                                                                                                                                                                                
  --with-threads \                                                                                                                                                                                                                
  --with-proj \                                                                                                                                                                                                                   
  --with-gdal=/usr/local/bin \                                                                                                                                                                                                    
  --with-php=../php-4.3.0 \                                                                                                                                                                                                       
  --with-gd=/usr/local \                                                                                                                                                                                                          
  --with-freetype=/usr/bin \                                                                                                                                                                                                      
  --with-pdf \                                                                                                                                                                                                                    
  --with-ogr \                                                                                                                                                                                                                    
  --with-gdal \                                                                                                                                                                                                                   
  --with-ming \                                                                                                                                                                                                                   
  --with-wmsclient \                                                                                                                                                                                                              
  --with-wfs \                                                                                                                                                                                                                    
  --with-wfs-client                                                                                                                                                                                                               
                                                                                                                                                                                                                                  
# I got an undefined "_snprintf" which required changing                                                                                                                                                                          
# mswmslayer.c to  #include <stdio.h>                                                                                                                                                                                             
# and replace "_snprintf" with "snprintf"                                                                                                                                                                                         
                                                                                                                                                                                                                                  
make                                                                                                                                                                                                                              
# DO NOT do a "make install"                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
cp legend mapserv scalebar /var/www/cgi-bin                                                                                                                                                                                       
cp mapscript/php3/php_mapscript.so /etc/httpd/php_mods/                                                                                                                                                                           
                                                                                                                                                                                                                                  
# add to /etc/httpd/conf/httpd.conf                                                                                                                                                                                               
                                                                                                                                                                                                                                  
#                                                                                                                                                                                                                                 
# For PHP scripts as CGI-BIN                                                                                                                                                                                                      
#                                                                                                                                                                                                                                 
AddType application/x-httpd-php-cgi .php .php4 .phtml                                                                                                                                                                             
Action  application/x-httpd-php-cgi /cgi-bin/php                                                                                                                                                                                  
                                                                                                                                                                                                                                  
/etc/rc.d/init.d/httpd restart                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
# create /var/www/html/info.php                                                                                                                                                                                                   
<?php                                                                                                                                                                                                                             
dl("php_mapscript.so");                                                                                                                                                                                                           
phpinfo();                                                                                                                                                                                                                        
?>                                                                                                                                                                                                                                
                                                                                                                                                                                                                                  
# check the output of http://yourhost/info.php                                                                                                                                                                                    
# for mapserver support                                                                                                                                                                                                           
Clone this wiki locally