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.

1 Answer 1


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
  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 install
    phpenmod mapscript
    service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.