Monday 17 September 2018

mapserver - How compile/install php-mapscript on Ubuntu 16.04


I need to upgrade from Ubuntu 14.04 to 16.04 but php5 is not officially supported on Ubuntu 16. I install php5.5 by ondrej repo https://askubuntu.com/a/756186/483814
but when I try to install php5-mapscript on it i get error :



root@ubuntu16:~# apt-get install php5-mapscript
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-mapscript is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5-mapscript' has no installation candidate


Therefore i try to compile and install php-mapscript from scratch but i don't find any updated and working manual.


So if somebody done it before or have general knowledge about mapserver compilation or if know how to install it from repositories please help.



Answer



Thanks to @ThomasG77 i did compile and install php5-mapscript of Mapserver7.0.2 compiled and got loaded successfully: enter image description here


The manual is based on mapserver general compile documentations: http://www.mapserver.org/installation/unix.html#compiling


Here is the manual I follow to compile [Ubuntu 16.04 /PHP 5.5.38-3+deb.sury.org~xenial+1]:




  1. installing php5.5:


    sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install php5.5


  2. download and extract mapserver source and change directory:


    wget http://download.osgeo.org/mapserver/mapserver-7.0.2.tar.gz
    tar xvf mapserver-7.0.2.tar.gz
    cd mapserver-7.0.2/



  3. install cmake


    sudo apt-get install cmake


  4. make build directory and change to it [~/mapserver-7.0.2/build]:


    mkdir build
    cd build



  5. install compile requirement


    apt-get install libfreetype6-dev 
    apt-get install php5.5-dev
    apt-get install libproj-dev
    apt-get install libfribidi-dev
    apt-get install libharfbuzz-dev
    apt-get install libcairo-dev
    apt-get install libgdal-dev
    apt-get install libgpg-dev



  6. config , compile and install


    cmake -DCMAKE_INSTALL_PREFIX=/opt \
    -DCMAKE_PREFIX_PATH=/usr/local/pgsql/91:/usr/local:/opt \
    -DWITH_CLIENT_WFS=ON \
    -DWITH_CLIENT_WMS=ON \
    -DWITH_CURL=ON \
    -DWITH_SOS=ON \
    -DWITH_PHP=ON \
    -DWITH_FCGI=OFF \

    -DWITH_PYTHON=OFF \
    -DWITH_SVGCAIRO=OFF \
    ../ >../configure.out.txt
    make
    make install
    echo extension=php_mapscript.so>/etc/php/5.5/mods-available/mapscript.ini
    phpenmod mapscript
    service apache2 restart



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...