| View previous topic :: View next topic |
| Author |
Message |
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Fri Mar 14, 2025 11:02 am Post subject: how to install MapServer |
|
|
I posted these instructions here: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptRH73
PHPMapScriptRH73
MapServerWiki | RecentChanges | Preferences
--------------------------------------------------------------------------------
Setting up MapServer/MapScript version 3.6 on RedHat 7.3
NOTE: These instructions were based on Detailed instructions to compile/install PHP MapScript 3.6 on RedHat 7.2.
Objective:
Configure a brand new RedHat 7.3 server to host MapServer-based apps:
- MapServer 3.6 (WMS)
- PHPMapScript 3.6
- GMap
Server Information:
We start with a clean RedHat 7.3 install, configured with Apache preinstalled but no PHP.
Source packages will be compiled under "/home/src" and installed in /usr/local
Web Server installed under /var/www:
DocRoot = /var/www/html
CGI dir = /var/www/cgi-bin
Config = /etc/httpd/conf
MapServer apps will be installed under /home/msapps using a logical link from /var/www/html/ -> /home/msapps/
--------------------------------------------------------------------------------
List of required files or packages:
proj-4.4.5.tar.gz
proj-nad27-1.1.tar.gz
gdal-1.1.7.tar.gz
gd-2.0.7gif.tar.gz
libwww-5.3.2-20011211.tar.gz (CVS version as of 2025-12-11)
php-4.2.3.tar.gz
mapserver-3.6.3.tar.gz
... and just for testing:
gmap-ms36.tar.gz
--------------------------------------------------------------------------------
COMPILE/INSTALL PROJ-4
$ cd /home/src
$ tar xzvf ~/arch/proj-4.4.5.tar.gz
$ cd proj-4.4.5/nad
$ tar xzvf ~/arch/proj-nad27-1.1.tar.gz
$ cd ..
$ ./configure
$ make
$ sudo make install
$ cd ..
... also copy the custom "epsg" file (with EPSG:42xxx projections: http://www2.dmsolutions.ca/mapserver/dl/proj4-epsg-with-42xxx.zip):
$ sudo cp ~/arch/epsg /usr/local/share/proj/epsg
... edit /etc/ld.so.conf and add /usr/local/lib, then run
$ sudo /sbin/ldconfig
--------------------------------------------------------------------------------
COMPILE/INSTALL GDAL
$ tar xzvf ~/arch/gdal-1.1.7.tar.gz
$ cd gdal-1.1.7
$ ./configure
$ make
$ sudo make install
$ cd ..
$ sudo /sbin/ldconfig
--------------------------------------------------------------------------------
COMPILE/INSTALL W3C-LIBWWW V5.3.2
... 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)
$ tar xzvf ~/arch/libwww-5.3.2-20011211.tar.gz
$ cd libwww
$ ./configure
$ make
$ sudo make install
$ cd ..
$ sudo /sbin/ldconfig
--------------------------------------------------------------------------------
COMPILE/INSTALL GD-2.0.7 (with GIF and TTF)
RH7.3 comes with a copy of gd-1.8.4 (without GIF) preinstalled. Since we want gd-2.0.7 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.
$ sudo rpm -e gd-devel-1.8.4-4
$ tar xzvf ~/arch/gd-2.0.7gif.tar.gz
$ cd gd-2.0.7gif
$ ./configure
$ make
$ sudo make install
$ cd ..
--------------------------------------------------------------------------------
COMPILE/INSTALL PHP 4
Note: We want PHP to use our custom GD compiled with Freetype 1.3, but PHP won't detect freetype by default. For PHP to detect the freetype1 headers, we have to create a logical link in /usr/include:
$ cd /usr/include
$ sudo ln -s freetype1/freetype freetype
... then we can proceed with normal PHP configuration.
$ tar xzvf ~/arch/php-4.2.3.tar.gz
$ cd php-4.2.3
Compilation will fail unless two source files are corrected. Apparently the method free() was renamed to gd_free().
Modify ./ext/gd/gd.c
Change line 1014 from io_ctx->free(io_ctx); to io_ctx->gd_free(io_ctx);
Change line 1017 from io_ctx->free(io_ctx); to io_ctx->gd_free(io_ctx);
Change line 1209 from io_ctx->free(io_ctx); to io_ctx->gd_free(io_ctx);
Modify ./ext/gd/gd_ctx.c
Change line 70 from ctx->free = _php_image_output_ctxfree; to ctx->gd_free = _php_image_output_ctxfree;
Change line 98 from ctx->free(ctx); to ctx->ctx->gd_free(ctx);
$ ./configure --enable-shared --with-regex=system --with-gd \
--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
$ make
$ strip php
$ sudo make install
$ sudo cp php /var/www/cgi-bin/php
$ sudo cp php.ini-dist /etc/httpd/conf/php.ini
$ cd ..
... edit /etc/httpd/conf/php.ini to set:
...
log_errors = On
...
extension_dir = /usr/local/lib/php/extensions/
...
... edit /etc/httpd/conf/httpd.conf
#
# And for PHP 4.x, use:
#
##
## Commented-out... we bypass the PHP module and use PHP4 as
## a CGI instead ... see below
##
## ... old config ...
##
# <IfModule mod_php4.c>
# AddType application/x-httpd-php .php .php4 .php3 .phtml
# AddType application/x-httpd-php-source .phps
# </IfModule>
##
## New PHP 4 CGI config
##
## Use a different application type to bypass the PHP DSO
##
AddType application/x-httpd-php4 .php4 .php3 .phtml .php
Action application/x-httpd-php4 /cgi-bin/php
Then restart the server using
$ sudo /etc/rc.d/init.d/httpd restart
--------------------------------------------------------------------------------
COMPILE/INSTALL MAPSERVER
$ tar xzvf ~/arch/mapserver-3.6.3.tar.gz
$ cd mapserver-3.6.3
$ ./configure --with-proj --with-wmsclient --with-libwww \
--with-gdal --enable-runpath --with-php=../php-4.2.3 \
--without-tiff --with-gd --enable-force-freetype1 \
--enable-internal-ld-detect
$ make
$ cp mapserv /var/www/cgi-bin/mapserv_36
$ sudo cp mapscript/php3/php_mapscript.so /usr/local/lib/php/extensions/php_mapscript_36.so
$ cd /usr/local/lib/php/extensions
$ sudo ln -s php_mapscript_36.so php_mapscript.so
--------------------------------------------------------------------------------
Setup MapServer IMAGEDIR and cleanup script
$ sudo mkdir /tmp/ms_tmp
$ sudo chmod 777 /tmp/ms_tmp
... 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...
... create a logical link for the ms_tmp directory on the web server
$ cd /var/www/html
$ ln -s /tmp/ms_tmp ms_tmp
... create "/etc/cron.daily/ms_clear_tmp.sh" ... you can also place the file in /etc/cron.hourly/ for busier sites...
#! /bin/sh
#
# MapServer temporary file cleanup - run daily by cron
#
# Flush all files from /tmp/ms_tmp older than 6 hours (360 minutes)
#
find /tmp/ms_tmp -name "*.*" -amin +360 -exec rm -f {} \;
exit 0
--------------------------------------------------------------------------------
SETUP GMAP DEMO
Install a copy of the latest GMap demo to test our installation:
$ cd /home/msapps
$ tar xzvf ~/arch/gmap-ms36.tar.gz
... create a link from the htdocs directory to the application's htdoc:
$ cd /var/www/html/
$ ln -s /home/msapps/gmap/htdocs gmap
... modify the .map file to provide the complete pathname to the FontSet:
Modify /home/msapps/gmap/htdocs/gmap75.map
Change the FONTSET line (14) to FONTSET /home/msapps/gmap/etc/fonts.txt
You should now be able to run GMap at
http://your.host.name/gmap/gmap75.phtml
--------------------------------------------------------------------------------
MapServerWiki | RecentChanges | Preferences
Edit text of this page | View other revisions
Last edited January 29, 2025 12:47 pm (diff)
Search:
Text Formatting Rules
MapServer Homepage |
|
| Back to top |
|
|
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Wed Apr 16, 2025 2:01 pm Post subject: add postgis to mapserver |
|
|
Add this to the ./configure step of MapServer
--with-postgis |
|
| Back to top |
|
|
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Mon Apr 21, 2025 3:58 pm Post subject: addition of shockwave support requires a bunch of stuff |
|
|
MapServer 3.7-devel
upgrade of curl
upgrade of ming 0.2a
recompilation of php --with-ming=(ming_dir)
upgrade to gdal 1.1.8
recompilation of mapserver3.7-devel --with-ming
Shockwave files (swf) will be part of the official 3.7 release. But I couldn't wait. |
|
| Back to top |
|
|
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Tue Apr 29, 2025 9:02 am Post subject: postgres-enable php |
|
|
--with-pgsql
So now the entire php ./configure looks like this:
| Code: | | './configure' '--enable-shared' '--with-regex=system' '--with-gd' '--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' '--with-ming=/usr/local/download/map/ming-0.2a' '--with-pgsql' |
Last edited by cpurvis on Tue Jul 29, 2025 10:40 am; edited 1 time in total |
|
| Back to top |
|
|
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Tue May 13, 2025 9:30 am Post subject: |
|
|
Building the 3.7 broke 3.6.
Doing a recompile of the mapscript_36.so (since I think libwww was affected) did the trick.
Currently:
mapscript_36.so
mapscript_37.so
and mapscript.so (which points to 36) are valid php dl's. |
|
| Back to top |
|
|
cpurvis
Joined: 24 Feb 2025 Posts: 179
|
| Posted: Thu Jul 31, 2025 3:15 pm Post subject: Time to review the install! |
|
|
Upgarde of php to php-4.3.2 caused muchos problemas. So here are the configures:
php
| Code: | | ./configure --enable-shared --with-regex=system --with-gd --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 --with-freetype-dir=/usr/include/freetype --with-pgsql |
mapserv
| Code: | | ./configure --with-proj --with-wmsclient --with-libwww --with-gdal --enable-runpath --with-php=../php-4.3.2 --without-tiff --with-gd --enable-force-freetype1 --enable-internal-ld-detect --with-postgis |
|
|
| Back to top |
|
|
|