SlideShare a Scribd company logo
INSTALLING MAPSERVER AND PHP MAPSCRIPT ON LINUX


Author    : Lorensius W. L. T
Email     : lorenz@londatiga.net
Website   : http://www.londatiga.net
Link       : http://www.londatiga.net/downloads/tutorial/mapserver_install_linux.pdf


Introduction

MapServer is an open source and free software for rendering maps, images, and vector data on the web.
MapServer was originally developed by the University of Minnesota (UMN) ForNet project in
cooperation with NASA and the Minnesota Department of Natural Resources. Presently, the MapServer
project is hosted by the TerraSIP, a NASA sponsored project between the UMN and consortium of land
management interests (http://mapserver.gis.umn.edu).

MapServer can be compiled on many platforms and operating systems, but in this tutorial, I will focus on
unix like system, especially Linux.

Prerequisites

Operating system used in this tutorial is Linux Fedora Core 7 with Apache (httpd-2.0.55), PHP (php-
5.2.3), and PostgreSQL(postgresql-8.2.4) already installed using manual source installation (not using
default rpm package). Required libraries that already installed are libpng, libjpeg, libtiff, and zlib.
Installation manual for those softwares and libraries are beyond the scope of this tutorial.

Required softwares and libraries:

    1. MapServer: is the main software.
       Source: http://download.osgeo.org/mapserver/mapserver-5.0.2.tar.gz
    2. GD: used by MapServer for rendering images, version 2.0.28 or greater is required.
       Source: http://www.libgd.org/releases/gd-2.0.35.tar.gz
    3. PROJ.4: provides projection support for MapServer (also needed by PostGIS), version 4.4.6 or
       greater is required.
       Source: ftp://ftp.remotesensing.org/proj/proj-4.6.0.tar.gz
    4. GEOS: enables MapServer to do spatial operation (within, touches, union, difference,
       intersection), also needed by PostGIS, version 4.10 or greater is required.
       Source: http://geos.refractions.net/downloads/geos-3.0.0.tar.bz2
    5. GDAL: provides access to at least 42 different raster formats.
       Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
    6. OGR: provides access to at least 18 different vector formats.
       Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
7. CURL: is the foundation of OGC (WFS, WMS, WCS) client and server support, requires version
       7.10 or greater.
       Source: http://curl.haxx.se/download/curl-7.18.1.tar.gz
    8. PostGIS: adds support for geographic objects to the PostgreSQL.
       Source: http://www.postgis.org/download/postgis-1.3.3.tar.gz

Note:
Apache was installed under /usr/local/apache
PostgreSQL was installed under /usr/local/pgsql
All previously installed libraries (libpng, libjpeg, libtiff, and zlib) were installed under /usr/lib
Apache root directory is /data/www/html, cgi-bin directory is /data/www/cgi-bin


Installation

    1. GD

        Installation steps:

                 [lorenz@devel>>installer]$ tar –xzvf gd-2.0.35.tar.gz
                 [lorenz@devel>>installer]$ cd gd-2.0.35
                 [lorenz@devel>>gd-2.0.35]$ ./configure
                 [lorenz@devel>>gd-2.0.35]$ make
                 [lorenz@devel>>gd-2.0.35]$ make install

        Note: default installation directory is /usr/local

    2. PROJ.4

        Installation steps:

                 [lorenz@devel>>installer]$ tar –xzvf proj-4.6.0.tar.gz
                 [lorenz@devel>>installer]$ cd proj-4.6.0
                 [lorenz@devel>>proj-4.6.0]$ ./configure
                 [lorenz@devel>> proj-4.6.0]$ make
                 [lorenz@devel>> proj-4.6.0]$ make install

        Note: default installation directory is /usr/local


    3. GEOS

        Installation steps:

                 [lorenz@devel>>installer]$ tar –xjvf geos-3.0.0.tar.bz2
                 [lorenz@devel>>installer]$ cd geos-3.0.0
[lorenz@devel>>geos-3.0.0]$ ./configure
           [lorenz@devel>>geos-3.0.0]$ make
           [lorenz@devel>>geos-3.0.0]$ make install

   Note: default installation directory is /usr/local


4. GDAL

   Installation steps:

           [lorenz@devel>>installer]$ tar –xzvf gdal-1.5.1.tar.gz
           [lorenz@devel>>installer]$ cd gdal-1.5.1
           [lorenz@devel>>gdal-1.5.1]$ ./configure
           [lorenz@devel>>gdal-1.5.1]$ make
           [lorenz@devel>>gdal-1.5.1]$ make install

   Note: default installation directory is /usr/local

5. CURL

   Installation steps:

           [lorenz@devel>>installer]$ tar –xzvf curl-7.18.1.tar.gz
           [lorenz@devel>>installer]$ cd curl-7.18.1
           [lorenz@devel>>curl-7.18.1]$ ./configure
           [lorenz@devel>>curl-7.18.1]$ make
           [lorenz@devel>>curl-7.18.1]$ make install

   Note: default installation directory is /usr/local

6. Update ld-config

           [lorenz@devel>>installer]$ cd /etc/ld.so.conf.d/
           [lorenz@devel>>ld.so.conf.d]$ echo /usr/local/lib > usrlocalib.conf
           [lorenz@devel>>ld.so.conf.d]$ /sbin/ldconfig


7. POSTGIS

   Installation steps:

           [lorenz@devel>>installer]$ tar –xzvf postgis-1.3.3.tar.gz
           [lorenz@devel>>installer]$ cd postgis-1.3.3
           [lorenz@devel>>postgis-1.3.3]$ ./configure --with-
           pgsql=/usr/local/pgsql/bin/pg_config --with-proj --with-geos
           [lorenz@devel>>postgis-1.3.3]$ make
[lorenz@devel>>postgis-1.3.3]$ make install



8. Recompile PHP as CGI

   Installation steps:

           [lorenz@devel>>installer]$ cd php-5.2.3
           [lorenz@devel> php-5.2.3 ]$ ./configure 
           > --enable-force-cgi-redirect 
           > --with-gd=/usr/local/ 
           > --with-jpeg-dir=/usr/lib 
           > --with-png-dir=/usr/lib 
           > --with-tiff-dir=/usr/lib 
           > --with-zlib-dir=/usr/lib 
           > --with-freetype-dir=/usr/lib 
           > --without-ttf 
           > --with-mysql=/usr/local/mysql/ 
           > --with-pgsql=/usr/local/pgsql/ 
           > --with-curl=/usr/local/ 
           > --with-gettext 
           > --enable-ftp 
           > --enable-xml 
           > --with-zlib 
           > --with-regex=system 
           > --enable-dbase 
           > --enable-dbx 
           > --with-config-file-path=/usr/local/lib
           [lorenz@devel>>php-5.2.3]$ make
           [lorenz@devel>>php-5.2.3]$ cp sapi/cgi/php-cgi /data/www/cgi-bin

       Note: DO NOT do a “make install”


9. MapServer

   Installation steps:

           [lorenz@devel>>installer]$ tar –xzvf mapserver-5.0.2.tar.gz
           [lorenz@devel>>installer]$ cd mapserver-5.0.2
           [lorenz@devel>>mapserver-5.0.2]$ ./configure --with-ogr=/usr/local/bin/gdal-config 
           --with-gdal=/usr/local/bin/gdal-config 
           --with-httpd=/usr/local/apache/bin/httpd 
           --with-wfsclient 
           --with-wmsclient 
           --enable-debug
--with-curl-config=/usr/local/bin/curl-config 
           --with-proj=/usr/local 
           --with-tiff 
           --with-gd=/usr/local 
           --with-jpeg 
           --with-freetype=/usr/ 
           --with-threads 
           --with-wcs 
           --with-postgis=/usr/local/pgsql/bin/pg_config 
           --with-libiconv=/usr 
           --with-geos=/usr/local/bin/geos-config 
           --with-xml2-config=/usr/bin/xml2-config 
           --with-sos 
           --with-php=../php-5.2.3/
           [lorenz@devel>>mapserver-5.0.2]$ make

   Note: DO NOT do a “make install”

   PHP MapScript installation steps;

           [lorenz@devel>>mapserver-5.0.2]$ cp mapserv legend scalebar /data/www/cgi-bin
           [lorenz@devel>>mapserver-5.0.2]$ mkdir /usr/local/lib/php/extensions
           [lorenz@devel>>mapserver-5.0.2]$ cp mapscript/php3/php_mapscript.so
           /usr/local/lib/php/extensions
           [lorenz@devel>>mapserver-5.0.2]$ cd /usr/local/lib
           Edit file php.ini and add two lines below:

           extension_dir = "/usr/local/lib/php/extensions"
           extension = "php_mapscript.so"

           Edit file /usr/local/apache/conf/httpd.conf and add two lines below:

           AddType application/x-httpd-php-cgi .phtml
           Action application/x-httpd-php-cgi /cgi-bin/php-cgi

           Restart apache (#/usr/local/apache/bin/apachectl restart)

10. Test PHP Mapscript

   To test PHP MapScript that already installed:

           Go into web root directory (/data/www/html)
           Create php file and add phpinfo() line into the file
           Save the file as info.phtml
           Open browser and point to http://localhost/info.phtml
           If installation is successful, the phpinfo page should contain part like this:
To test drawing map, you can download simple demo application from
http://www.londatiga.net/downloads/tutorial/phpmapscript-demo.tar.gz

Installation steps:

        [lorenz@devel>>installer]$ cp phpmapscript-demo.tar.gz /data/www/html
        [lorenz@devel>>installer]$ cd /data/www/html
        [lorenz@devel>>html]$ tar –xzvf phpmapscript-demo.tar.gz
        [lorenz@devel>>html]$ chmod 777 tmp
        Open browser and point to http://localhost/phpmapscript-demo
        If all things running well it should display a map

More Related Content

What's hot (16)

PDF
Open Source Backup Conference 2014: Workshop bareos introduction, by Philipp ...
NETWAYS
 
PDF
[ETHCon Korea 2019] Shin mansun 신만선
ethconkr
 
PDF
Paver For PyWorks 2008
Kevin Dangoor
 
PDF
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
PDF
Conquering the Command Line
Adrian Cardenas
 
PDF
First there was the command line
Adrian Cardenas
 
PDF
Learning the command line
Adrian Cardenas
 
KEY
Clojure + MongoDB on Heroku
Naoyuki Kakuda
 
PDF
Backups
Svet Ivantchev
 
PDF
Хокку про Heroku
Serge Seletskyy
 
PDF
Docker for data science
Calvin Giles
 
PDF
Postgresql 12 streaming replication hol
Vijay Kumar N
 
PDF
Installing Cacti openSUSE Leap 42.1
Didiet A. Pambudiono
 
PDF
Os Treat
oscon2007
 
ODP
Linux-Fu for PHP Developers
Lorna Mitchell
 
PDF
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
Puppet
 
Open Source Backup Conference 2014: Workshop bareos introduction, by Philipp ...
NETWAYS
 
[ETHCon Korea 2019] Shin mansun 신만선
ethconkr
 
Paver For PyWorks 2008
Kevin Dangoor
 
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
Conquering the Command Line
Adrian Cardenas
 
First there was the command line
Adrian Cardenas
 
Learning the command line
Adrian Cardenas
 
Clojure + MongoDB on Heroku
Naoyuki Kakuda
 
Хокку про Heroku
Serge Seletskyy
 
Docker for data science
Calvin Giles
 
Postgresql 12 streaming replication hol
Vijay Kumar N
 
Installing Cacti openSUSE Leap 42.1
Didiet A. Pambudiono
 
Os Treat
oscon2007
 
Linux-Fu for PHP Developers
Lorna Mitchell
 
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
Puppet
 

Viewers also liked (15)

PDF
PROFESSORES PRINCIPIANTES E O DESENVOLVIMENTO PROFISSIONAL DA DOCÊNCIA NOS AN...
ProfessorPrincipiante
 
PPT
Общественно-политические настроения населения Украины
Andrew Vodianyi
 
PPTX
Phoenix golf resort
United Golf Services
 
DOC
New Study Of Gita Nov 6 Dr Shriniwas J Kashalikar
banothkishan
 
PPTX
C9 - Executives
Fatin Nazihah Aziz
 
PDF
JOGOS E RESOLUÇÃO DE PROBLEMAS: ALTERNATIVAS METODOLÓGICAS PARA O ENSINO DO C...
ProfessorPrincipiante
 
PDF
BNI Kigdom - Ciocia Renia
BNIKingdom
 
PPT
A journey to kechla
Santakar Chelapila
 
PDF
A IMPORTÂNCIA DA FORMAÇÃO INICIAL DE PROFESSORES DE CIÊNCIAS: O ENSINO DE AST...
ProfessorPrincipiante
 
PPTX
16 1 Powerpoint
Tamara
 
PPTX
T
eider99
 
PPT
1 5 Job Interviews
Fauquier Horticulture
 
PPTX
21 лютого – день рідної pptx
Танюха Шарік
 
DOCX
Codigos para html
Guillermo Ce
 
PPTX
CQRS: An Introduction for Beginners
Jonathan Oliver
 
PROFESSORES PRINCIPIANTES E O DESENVOLVIMENTO PROFISSIONAL DA DOCÊNCIA NOS AN...
ProfessorPrincipiante
 
Общественно-политические настроения населения Украины
Andrew Vodianyi
 
Phoenix golf resort
United Golf Services
 
New Study Of Gita Nov 6 Dr Shriniwas J Kashalikar
banothkishan
 
C9 - Executives
Fatin Nazihah Aziz
 
JOGOS E RESOLUÇÃO DE PROBLEMAS: ALTERNATIVAS METODOLÓGICAS PARA O ENSINO DO C...
ProfessorPrincipiante
 
BNI Kigdom - Ciocia Renia
BNIKingdom
 
A journey to kechla
Santakar Chelapila
 
A IMPORTÂNCIA DA FORMAÇÃO INICIAL DE PROFESSORES DE CIÊNCIAS: O ENSINO DE AST...
ProfessorPrincipiante
 
16 1 Powerpoint
Tamara
 
1 5 Job Interviews
Fauquier Horticulture
 
21 лютого – день рідної pptx
Танюха Шарік
 
Codigos para html
Guillermo Ce
 
CQRS: An Introduction for Beginners
Jonathan Oliver
 
Ad

Similar to mapserver_install_linux (20)

PDF
2010 13.guide de_la_programmation_avec_qgis_1.5_extensions_et_applications_pr...
Eduardo Nuno
 
DOCX
Tutorial to setup OpenStreetMap tileserver with customized boundaries of India
Arun Ganesh
 
PDF
PHP selber bauen
Walter Ebert
 
PPT
Server side geo_tools_in_drupal_pnw_2012
Mack Hardy
 
PDF
Integrating PostGIS in Web Applications
Command Prompt., Inc
 
PDF
Fossgis 2013 GeoServer Presentation
GeoSolutions
 
PPTX
Final map server
Janak Parajuli
 
PDF
9 steps to install and configure postgre sql from source on linux
chinkshady
 
PDF
Saving Money with Open Source GIS
bryanluman
 
ODP
Geospatial web services using little-known GDAL features and modern Perl midd...
Ari Jolma
 
PDF
Foss4g it-2011 (english)
GeoSolutions
 
PPTX
Introduction to GIS
Hans van der Kwast
 
DOCX
How to install_and_configure_r_on_a_linux_server
sushantbit04
 
PPTX
GeoServer Feature Frenzy
Jody Garnett
 
ODP
AGES Presentation on Web, Python, Django and GeoServer
Ng'eno Victor
 
PDF
GeoServer Feature FRENZY
GeoSolutions
 
PDF
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
tutorialsruby
 
PDF
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
tutorialsruby
 
PDF
QGIS tutorial for GIS and mapping technique
ssusera9462d1
 
PPTX
Installing and updating software packages [autosaved]
ANIMESHKUMARSINHA2
 
2010 13.guide de_la_programmation_avec_qgis_1.5_extensions_et_applications_pr...
Eduardo Nuno
 
Tutorial to setup OpenStreetMap tileserver with customized boundaries of India
Arun Ganesh
 
PHP selber bauen
Walter Ebert
 
Server side geo_tools_in_drupal_pnw_2012
Mack Hardy
 
Integrating PostGIS in Web Applications
Command Prompt., Inc
 
Fossgis 2013 GeoServer Presentation
GeoSolutions
 
Final map server
Janak Parajuli
 
9 steps to install and configure postgre sql from source on linux
chinkshady
 
Saving Money with Open Source GIS
bryanluman
 
Geospatial web services using little-known GDAL features and modern Perl midd...
Ari Jolma
 
Foss4g it-2011 (english)
GeoSolutions
 
Introduction to GIS
Hans van der Kwast
 
How to install_and_configure_r_on_a_linux_server
sushantbit04
 
GeoServer Feature Frenzy
Jody Garnett
 
AGES Presentation on Web, Python, Django and GeoServer
Ng'eno Victor
 
GeoServer Feature FRENZY
GeoSolutions
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
tutorialsruby
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
tutorialsruby
 
QGIS tutorial for GIS and mapping technique
ssusera9462d1
 
Installing and updating software packages [autosaved]
ANIMESHKUMARSINHA2
 
Ad

More from tutorialsruby (20)

PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
TopStyle Help & <b>Tutorial</b>
tutorialsruby
 
PDF
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
tutorialsruby
 
PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
PDF
xhtml_basics
tutorialsruby
 
PDF
xhtml_basics
tutorialsruby
 
PDF
xhtml-documentation
tutorialsruby
 
PDF
xhtml-documentation
tutorialsruby
 
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
PDF
HowTo_CSS
tutorialsruby
 
PDF
HowTo_CSS
tutorialsruby
 
PDF
BloggingWithStyle_2008
tutorialsruby
 
PDF
BloggingWithStyle_2008
tutorialsruby
 
PDF
cascadingstylesheets
tutorialsruby
 
PDF
cascadingstylesheets
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
TopStyle Help & <b>Tutorial</b>
tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
xhtml_basics
tutorialsruby
 
xhtml_basics
tutorialsruby
 
xhtml-documentation
tutorialsruby
 
xhtml-documentation
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
HowTo_CSS
tutorialsruby
 
HowTo_CSS
tutorialsruby
 
BloggingWithStyle_2008
tutorialsruby
 
BloggingWithStyle_2008
tutorialsruby
 
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
tutorialsruby
 

Recently uploaded (20)

PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Next level data operations using Power Automate magic
Andries den Haan
 
PPTX
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Practical Applications of AI in Local Government
OnBoard
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Next level data operations using Power Automate magic
Andries den Haan
 
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 

mapserver_install_linux

  • 1. INSTALLING MAPSERVER AND PHP MAPSCRIPT ON LINUX Author : Lorensius W. L. T Email : [email protected] Website : http://www.londatiga.net Link : http://www.londatiga.net/downloads/tutorial/mapserver_install_linux.pdf Introduction MapServer is an open source and free software for rendering maps, images, and vector data on the web. MapServer was originally developed by the University of Minnesota (UMN) ForNet project in cooperation with NASA and the Minnesota Department of Natural Resources. Presently, the MapServer project is hosted by the TerraSIP, a NASA sponsored project between the UMN and consortium of land management interests (http://mapserver.gis.umn.edu). MapServer can be compiled on many platforms and operating systems, but in this tutorial, I will focus on unix like system, especially Linux. Prerequisites Operating system used in this tutorial is Linux Fedora Core 7 with Apache (httpd-2.0.55), PHP (php- 5.2.3), and PostgreSQL(postgresql-8.2.4) already installed using manual source installation (not using default rpm package). Required libraries that already installed are libpng, libjpeg, libtiff, and zlib. Installation manual for those softwares and libraries are beyond the scope of this tutorial. Required softwares and libraries: 1. MapServer: is the main software. Source: http://download.osgeo.org/mapserver/mapserver-5.0.2.tar.gz 2. GD: used by MapServer for rendering images, version 2.0.28 or greater is required. Source: http://www.libgd.org/releases/gd-2.0.35.tar.gz 3. PROJ.4: provides projection support for MapServer (also needed by PostGIS), version 4.4.6 or greater is required. Source: ftp://ftp.remotesensing.org/proj/proj-4.6.0.tar.gz 4. GEOS: enables MapServer to do spatial operation (within, touches, union, difference, intersection), also needed by PostGIS, version 4.10 or greater is required. Source: http://geos.refractions.net/downloads/geos-3.0.0.tar.bz2 5. GDAL: provides access to at least 42 different raster formats. Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz 6. OGR: provides access to at least 18 different vector formats. Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
  • 2. 7. CURL: is the foundation of OGC (WFS, WMS, WCS) client and server support, requires version 7.10 or greater. Source: http://curl.haxx.se/download/curl-7.18.1.tar.gz 8. PostGIS: adds support for geographic objects to the PostgreSQL. Source: http://www.postgis.org/download/postgis-1.3.3.tar.gz Note: Apache was installed under /usr/local/apache PostgreSQL was installed under /usr/local/pgsql All previously installed libraries (libpng, libjpeg, libtiff, and zlib) were installed under /usr/lib Apache root directory is /data/www/html, cgi-bin directory is /data/www/cgi-bin Installation 1. GD Installation steps: [lorenz@devel>>installer]$ tar –xzvf gd-2.0.35.tar.gz [lorenz@devel>>installer]$ cd gd-2.0.35 [lorenz@devel>>gd-2.0.35]$ ./configure [lorenz@devel>>gd-2.0.35]$ make [lorenz@devel>>gd-2.0.35]$ make install Note: default installation directory is /usr/local 2. PROJ.4 Installation steps: [lorenz@devel>>installer]$ tar –xzvf proj-4.6.0.tar.gz [lorenz@devel>>installer]$ cd proj-4.6.0 [lorenz@devel>>proj-4.6.0]$ ./configure [lorenz@devel>> proj-4.6.0]$ make [lorenz@devel>> proj-4.6.0]$ make install Note: default installation directory is /usr/local 3. GEOS Installation steps: [lorenz@devel>>installer]$ tar –xjvf geos-3.0.0.tar.bz2 [lorenz@devel>>installer]$ cd geos-3.0.0
  • 3. [lorenz@devel>>geos-3.0.0]$ ./configure [lorenz@devel>>geos-3.0.0]$ make [lorenz@devel>>geos-3.0.0]$ make install Note: default installation directory is /usr/local 4. GDAL Installation steps: [lorenz@devel>>installer]$ tar –xzvf gdal-1.5.1.tar.gz [lorenz@devel>>installer]$ cd gdal-1.5.1 [lorenz@devel>>gdal-1.5.1]$ ./configure [lorenz@devel>>gdal-1.5.1]$ make [lorenz@devel>>gdal-1.5.1]$ make install Note: default installation directory is /usr/local 5. CURL Installation steps: [lorenz@devel>>installer]$ tar –xzvf curl-7.18.1.tar.gz [lorenz@devel>>installer]$ cd curl-7.18.1 [lorenz@devel>>curl-7.18.1]$ ./configure [lorenz@devel>>curl-7.18.1]$ make [lorenz@devel>>curl-7.18.1]$ make install Note: default installation directory is /usr/local 6. Update ld-config [lorenz@devel>>installer]$ cd /etc/ld.so.conf.d/ [lorenz@devel>>ld.so.conf.d]$ echo /usr/local/lib > usrlocalib.conf [lorenz@devel>>ld.so.conf.d]$ /sbin/ldconfig 7. POSTGIS Installation steps: [lorenz@devel>>installer]$ tar –xzvf postgis-1.3.3.tar.gz [lorenz@devel>>installer]$ cd postgis-1.3.3 [lorenz@devel>>postgis-1.3.3]$ ./configure --with- pgsql=/usr/local/pgsql/bin/pg_config --with-proj --with-geos [lorenz@devel>>postgis-1.3.3]$ make
  • 4. [lorenz@devel>>postgis-1.3.3]$ make install 8. Recompile PHP as CGI Installation steps: [lorenz@devel>>installer]$ cd php-5.2.3 [lorenz@devel> php-5.2.3 ]$ ./configure > --enable-force-cgi-redirect > --with-gd=/usr/local/ > --with-jpeg-dir=/usr/lib > --with-png-dir=/usr/lib > --with-tiff-dir=/usr/lib > --with-zlib-dir=/usr/lib > --with-freetype-dir=/usr/lib > --without-ttf > --with-mysql=/usr/local/mysql/ > --with-pgsql=/usr/local/pgsql/ > --with-curl=/usr/local/ > --with-gettext > --enable-ftp > --enable-xml > --with-zlib > --with-regex=system > --enable-dbase > --enable-dbx > --with-config-file-path=/usr/local/lib [lorenz@devel>>php-5.2.3]$ make [lorenz@devel>>php-5.2.3]$ cp sapi/cgi/php-cgi /data/www/cgi-bin Note: DO NOT do a “make install” 9. MapServer Installation steps: [lorenz@devel>>installer]$ tar –xzvf mapserver-5.0.2.tar.gz [lorenz@devel>>installer]$ cd mapserver-5.0.2 [lorenz@devel>>mapserver-5.0.2]$ ./configure --with-ogr=/usr/local/bin/gdal-config --with-gdal=/usr/local/bin/gdal-config --with-httpd=/usr/local/apache/bin/httpd --with-wfsclient --with-wmsclient --enable-debug
  • 5. --with-curl-config=/usr/local/bin/curl-config --with-proj=/usr/local --with-tiff --with-gd=/usr/local --with-jpeg --with-freetype=/usr/ --with-threads --with-wcs --with-postgis=/usr/local/pgsql/bin/pg_config --with-libiconv=/usr --with-geos=/usr/local/bin/geos-config --with-xml2-config=/usr/bin/xml2-config --with-sos --with-php=../php-5.2.3/ [lorenz@devel>>mapserver-5.0.2]$ make Note: DO NOT do a “make install” PHP MapScript installation steps; [lorenz@devel>>mapserver-5.0.2]$ cp mapserv legend scalebar /data/www/cgi-bin [lorenz@devel>>mapserver-5.0.2]$ mkdir /usr/local/lib/php/extensions [lorenz@devel>>mapserver-5.0.2]$ cp mapscript/php3/php_mapscript.so /usr/local/lib/php/extensions [lorenz@devel>>mapserver-5.0.2]$ cd /usr/local/lib Edit file php.ini and add two lines below: extension_dir = "/usr/local/lib/php/extensions" extension = "php_mapscript.so" Edit file /usr/local/apache/conf/httpd.conf and add two lines below: AddType application/x-httpd-php-cgi .phtml Action application/x-httpd-php-cgi /cgi-bin/php-cgi Restart apache (#/usr/local/apache/bin/apachectl restart) 10. Test PHP Mapscript To test PHP MapScript that already installed: Go into web root directory (/data/www/html) Create php file and add phpinfo() line into the file Save the file as info.phtml Open browser and point to http://localhost/info.phtml If installation is successful, the phpinfo page should contain part like this:
  • 6. To test drawing map, you can download simple demo application from http://www.londatiga.net/downloads/tutorial/phpmapscript-demo.tar.gz Installation steps: [lorenz@devel>>installer]$ cp phpmapscript-demo.tar.gz /data/www/html [lorenz@devel>>installer]$ cd /data/www/html [lorenz@devel>>html]$ tar –xzvf phpmapscript-demo.tar.gz [lorenz@devel>>html]$ chmod 777 tmp Open browser and point to http://localhost/phpmapscript-demo If all things running well it should display a map