如何在 Ubuntu 16.04 上编译/安装 php-mapscript

如何在 Ubuntu 16.04 上编译/安装 php-mapscript

我需要从 Ubuntu 14.04 升级到 16.04,但是 Ubuntu 16 不正式支持 php5。我通过ondrejrepo安装 php5.5https://askubuntu.com/a/756186/483814
但是当我尝试安装php5-mapscript它时出现错误:

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

因此,我尝试从头开始编译和安装 php-mapscript,但我找不到任何更新且可用的手册。

因此,如果有人以前做过这件事或者对 mapserver 编译有一般了解或者知道如何从存储库安装它,请提供帮助。

答案1

感谢@ThomasG77,我确实编译并安装了 Mapserver7.0.2 的 php5-mapscript,并且成功加载: 在此处输入图片描述

该手册基于mapserver通用编译文档: http://www.mapserver.org/installation/unix.html#compiling

这是我编译[Ubuntu 16.04 /PHP 5.5.38-3+deb.sury.org~xenial+1]所遵循的手册:

  1. 安装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. 下载并解压 mapserver 源并更改目录:

    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. 安装 cmake

    sudo apt-get install cmake
    
  4. 创建build目录并更改为[〜/ mapserver-7.0.2 / build]:

    mkdir build
    cd build
    
  5. 安装编译要求

    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. 配置、编译和安装

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

相关内容