Install MapServer On Ubuntu 14.04

Prerequisite: Ubuntu 14.04, Apache Webserver 2.4 and php 5.6

Install PostgreSQL. Read How To Install and Use PostgreSQL on Ubuntu 14.04:

  1. Update system
  2. Install Postgres package and a “contrib” package that adds some additional utilities and functionality
  3. PostgreSQL Roles and Databases
    created a user account called ‘postgres’

    get a Postgres prompt immediately by typing

    Type ‘\q’ to quit! I can see my postgresql version is 9.3.14. Watch the above carefully! MY USER ALSO BE CHANGED FROM ‘teddy@teddy-K43SJ’ to ‘postgres@teddy-K43SJ’! To quit completely, type ‘exit’

    HERE WE DON’T THE PASSWORD FOR ‘postgres’ ROLE, SO ALTER IT (Read ‘How connect Postgres to localhost server using pgAdmin on Ubuntu?‘)

    SO (without quote) user = ‘postgres’ and password = ‘postgres’

    Install pgadmin 3

    To open it, you can type : pgadmin3 or (better) go to Applications-> Programming->pgAdmin III

    Create local connection with pgadmin:
    1. Click ‘Add a connection to a server’ or File->Add Server. Then fill itpsql-new-serverClick ‘OK’ and if everything right, here is the resultpsql-localhostCreate a new database. Select ‘Databases’->right click and click ‘New Database…’-> On ‘Name’ fill (for example) ‘testdb’psql-new-dbThen OK. There would be a ‘red cross’ on the database name. It’s fine. Just click it. Here is the structurepsql-structure-dbCreate a new table. We can do it from the structure above: Select ‘Tables’ -> right click and click ‘New Table…’ OR (better) from SQL Querypsql-create-tableHere is the result of the new tabel ‘playground’ (DONT FORGET TO REFRESH FIRST)psql-table-playgroundFor more command and samples, read How To Install and Use PostgreSQL on Ubuntu 14.04 or watch this video

Install MapServer

  1. Update your ubuntu system
  2. Install the MapServer packages and the companions

    But I got this error:

    Why??? I check my php version. its 5.6.23-1 version

    Here is my apache2 version.

    My ubuntu still use a deprecated ppa for php 5.6. From this link https://launchpad.net/~ondrej/+archive/ubuntu/php5-5.6, its suggest me to change my ppa to the stable one. Read the explanation PPA migration to ppa:ondrej php and from askubuntu. Read here to find out the steps to change the ppa, the problem and the solution.
    Okay. I tried to rety the installation

    The mapserver can be installed successfully BUT I got an error for php5-mapscript (I can’t install php-mapscript because the package is not available).

    It also caused my system broken.
    php5-mapscript-error
    It seems php5-mapscript can’t be installed on my php 5.6. This article PHP mapscript fails to build with PHP 5.6 dont help either. Right now I haven’t found any solution yet. I just don’t have time. Next time I’ll try to find the solution or install the different php version like php 5.5 or even php 7.0 to make mapscript work. I heard mapscript on the way to support php 7.0. Please read Support for PHP 7.
    UPDATE! I try to use php 5.5 but DIDN’T WORK EITHER FOR MAPSCRIPT!! MAY BE I NEED TO USE PHP5 FROM DEPRECATED PPA???

    I still tried to force the mapscript installation. I found something interesting about mapscript in my system.


    I found ‘mapscript.ini’ file and ‘php_mapscript.so’ file but it reside on different directory that php5.6 should be stored. the ‘.ini’ file supposed to be in /etc/php/5.6/mods-available/ and the extension/library ‘.so’ file supposed to be in /usr/lib/php/20131226 (found in phpinfo in ‘extension_dir’). I tried to copy them to the proper directory

    then enable the module

    also add it in ‘/etc/php/5.6/apache2/php.ini’


    Restart apache
    I found no error on phpinfo but found a warning on terminal

    Solution for this is to remove the mapscript in php.ini and also remove mapscript.ini

    then restart apache. Now there is no mapscript error on the terminal

    UPDATE 2017-02-14:
    Trying to install again. There is no package with named ‘php5.6-mapscript’

    Trying with ‘php5-mapscript’

    Also there is an error in my systemMay be I need to compile it from the source like I did here: https://github.com/oerdnj/deb.sury.org/issues/461.
  3. References
    Reference: https://www.youtube.com/watch?v=wabttt1tZhw and https://www.youtube.com/watch?v=9MGbM2zMA_Y

Leave a Reply

Your email address will not be published. Required fields are marked *