Changes between Initial Version and Version 1 of PHPMapScriptRH72


Ignore:
Timestamp:
Jan 27, 2009, 8:46:29 AM (15 years ago)
Author:
jmckenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PHPMapScriptRH72

    v1 v1  
     1= Setting up !MapServer/!MapScript version 3.6 on !RedHat 7.2 =
     2
     3NOTE: these instructions have been used on RedHat? 7.3 clean install and were found to work with one slight problem noted below in the mapserver section. (Actually, it's not, so visit Detailed instructions to compile/install PHP MapScript 3.6 on RedHat 7.3.)
     4
     5== Objective ==
     6
     7Configure a brand new RedHat? 7.2 server to host MapServer-based apps:
     8
     9  - MapServer 3.6 (WMS)
     10  - PHPMapScript 3.6
     11  - GMap
     12
     13== Server Information ==
     14
     15We start with a clean RedHat? 7.2 install, configured with Apache preinstalled but no PHP.
     16
     17Source packages will be compiled under "/home/src" and installed in /usr/local
     18
     19Web Server installed under /var/www:
     20
     21 DocRoot? = /var/www/html
     22 CGI dir = /var/www/cgi-bin
     23 Config  = /etc/httpd/conf
     24
     25MapServer apps will be installed under /home/msapps using a logical link from /var/www/html/ -> /home/msapps/
     26
     27List of required files or packages:
     28
     29  proj-4.4.5.tar.gz
     30  proj-nad27-1.1.tar.gz
     31
     32  gdal-1.1.7.tar.gz
     33
     34  libwww-5.3.2-20011211.tar.gz (CVS version as of 2001-12-11)
     35
     36  php-4.2.3.tar.gz
     37
     38  mapserver-3.6.3.tar.gz
     39
     40... and just for testing:
     41
     42  gmap-ms36.tar.gz
     43
     44== COMPILE/INSTALL PROJ-4 ==
     45
     46  $ cd /home/src
     47  $ tar xzvf ~/arch/proj-4.4.5.tar.gz
     48  $ cd proj-4.4.5/nad
     49  $ tar xzvf ~/arch/proj-nad27-1.1.tar.gz
     50  $ cd ..
     51  $ ./configure
     52  $ make
     53  $ sudo make install
     54  $ cd ..
     55
     56... also copy the custom "epsg" file (with EPSG:42xxx projections: http://www2.dmsolutions.ca/mapserver/dl/proj4-epsg-with-42xxx.zip):
     57
     58  $ sudo cp ~/arch/epsg /usr/local/share/proj/epsg
     59
     60... edit /etc/ld.so.conf and add /usr/local/lib, then run
     61
     62  $ sudo /sbin/ldconfig
     63
     64== COMPILE/INSTALL GDAL ==
     65
     66  $ tar xzvf ~/arch/gdal-1.1.7.tar.gz
     67  $ cd gdal-1.1.7
     68  $ ./configure
     69  $ make
     70  $ sudo make install
     71  $ cd ..
     72  $ sudo /sbin/ldconfig
     73
     74== COMPILE/INSTALL W3C-LIBWWW V5.3.2 ==
     75
     76... w3c-libwww version 5.3.2 with the latest fixes can be obtained only via CVS, but for this install, I've tared the copy that was previously downloaded and built on another server... it's simpler this way ;) (http://www2.dmsolutions.ca/mapserver/dl/misc/libwww-5.3.2-20011211.tar.gz)
     77
     78  $ tar xzvf ~/arch/libwww-5.3.2-20011211.tar.gz 
     79  $ cd libwww
     80  $ ./configure
     81  $ make
     82  $ sudo make install
     83  $ cd ..
     84  $ sudo /sbin/ldconfig
     85
     86== COMPILE/INSTALL GD-1.8.4 (with GIF and TTF) ==
     87
     88RH7.2 comes with a copy of gd-1.8.4 (without GIF) preinstalled. Since we want gd-1.8.4 with GIF (http://www.rime.com.au/gd/), we have to uninstall gd-devel-1.8.4-4.rpm and then install our new copy of gd under /usr/local/lib. This won't affect or break existing applications because removing the RPM only removes /usr/lib/libgd.so (logical link) and /usr/lib/libgd.a and the associated headers, but the physical file (libgd.so.1.8.4) will remain there for applications that came preinstalled on the RH system.
     89
     90  $ sudo rpm -e gd-devel-1.8.4-4
     91
     92  $ tar xzvf ~/arch/gd-1.8.4gif.tar.gz 
     93  $ cd gd-1.8.4
     94
     95... edit Makefile to compile with Freetype1... MapServer seems to have problem loading fonts when using gd compiled with Freetype2 on RH7.x
     96
     97  CFLAGS=-O -DHAVE_LIBXPM -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBTTF
     98  LIBS=-lgd -lpng -lz -ljpeg -lm -lttf
     99  INCLUDEDIRS=-I. -I/usr/include/freetype1/freetype -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include
     100
     101  $ make
     102  $ sudo make install
     103  $ cd ..
     104
     105== COMPILE/INSTALL PHP 4 ==
     106
     107Note: We want PHP to use our custom GD compiled with Freetype 1.3, but PHP won't detect freetype by default. PHP looks for freetype1 headers under /usr/include/freetype and $with_ttf/include/freetype, but RH7.2 has them under /usr/include/freetype1/freetype ... this has been filed as bug 17130 in the PHP bugs database. Until this is fixed, for PHP to detect the freetype1 headers, we have to create a logical link in /usr/include:
     108
     109  $ cd /usr/include
     110  $ sudo ln -s freetype1/freetype freetype
     111
     112... then we can proceed with normal PHP configuration.
     113
     114  $ tar xzvf ~/arch/php-4.2.3.tar.gz 
     115  $ cd php-4.2.3
     116
     117  $ ./configure  --enable-shared --with-regex=system --with-gd=/usr/local      --with-ttf=/usr --enable-gd-native-ttf --with-jpeg-dir=/usr      --with-png-dir=/usr --with-zlib --enable-force-cgi-redirect      --enable-dbase --with-config-file-path=/etc/httpd/conf
     118
     119  $ make
     120  $ strip php
     121  $ sudo make install
     122  $ sudo cp php /var/www/cgi-bin/php
     123  $ sudo cp php.ini-dist /etc/httpd/conf/php.ini
     124  $ cd ..
     125
     126... edit /etc/httpd/conf/php.ini to set:
     127
     128  ...
     129  log_errors = On
     130  ...
     131  extension_dir = /usr/local/lib/php/extensions/
     132  ...
     133
     134... edit /etc/httpd/conf/httpd.conf
     135
     136    #
     137    # And for PHP 4.x, use:
     138    #
     139 ##
     140 ## Commented-out... we bypass the PHP module and use PHP4 as
     141 ## a CGI instead ... see below
     142 ##
     143 ## ... old config ...
     144 ##
     145 #    <IfModule? mod_php4.c>
     146 #        AddType application/x-httpd-php .php .php4 .php3 .phtml
     147 #        AddType application/x-httpd-php-source .phps
     148 #    </IfModule?>
     149 ##
     150 ## New PHP 4 CGI config
     151 ##
     152 ## Use a different application type to bypass the PHP DSO
     153 ##
     154 AddType application/x-httpd-php4 .php4 .php3 .phtml .php
     155 Action  application/x-httpd-php4 /cgi-bin/php
     156
     157Then restart the server using
     158
     159  $ sudo /etc/rc.d/init.d/httpd restart
     160
     161== COMPILE/INSTALL MAPSERVER ==
     162
     163  $ tar xzvf ~/arch/mapserver-3.6.3.tar.gz
     164  $ cd mapserver-3.6.3
     165  $ ./configure --with-proj --with-wmsclient --with-libwww --with-gdal --enable-runpath --with-php=../php-4.2.3 --without-tiff --with-gd --enable-force-freetype1
     166
     167  $ make
     168
     169  $ cp mapserv /var/www/cgi-bin/mapserv_36
     170  $ sudo cp mapscript/php3/php_mapscript.so /usr/local/lib/php/extensions/php_mapscript_36.so
     171
     172== Setup MapServer IMAGEDIR and cleanup script ==
     173
     174  $ sudo mkdir /tmp/ms_tmp
     175  $ sudo chmod 777 /tmp/ms_tmp
     176
     177... also add the commands above to /etc/rc.d/rc.local as well to recreate the directory when the system reboots, after a /tmp cleanup...
     178
     179... create a logical link for the ms_tmp directory on the web server
     180
     181  $ cd /var/www/html
     182  $ ln -s /tmp/ms_tmp ms_tmp
     183
     184... create "/etc/cron.daily/ms_clear_tmp.sh" ... you can also place the file in /etc/cron.hourly/ for busier sites...
     185
     186 #! /bin/sh
     187 #
     188 # MapServer temporary file cleanup - run daily by cron
     189 #
     190 # Flush all files from /tmp/ms_tmp older than 6 hours (360 minutes)
     191 #
     192 find /tmp/ms_tmp -name "*.*" -amin +360 -exec rm -f {} \;
     193 exit 0
     194
     195== SETUP GMAP DEMO ===
     196
     197Install a copy of the latest GMap demo to test our installation:
     198
     199 $ cd /home/msapps
     200 $ tar xzvf ~/arch/gmap-ms36.tar.gz
     201
     202... create a link from the htdocs directory to the application's htdoc:
     203
     204 $ cd /var/www/html/
     205 $ ln -s /home/msapps/gmap/htdocs gmap
     206
     207You should now be able to run GMap at
     208
     209    http://your.host.name/gmap/gmap75.phtml