-
-
Notifications
You must be signed in to change notification settings - Fork 398
PHPNG SWIG MapScript Linux Build
rgreenwood edited this page Apr 26, 2019
·
2 revisions
The steps below build the PHP7 MapScript SWIG bindings on Ubuntu 16.04.6 LTS (tested on a DigitalOcean droplet):
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
sudo apt-get update
sudo apt-get install -y build-essential ca-certificates curl wget
sudo apt-get install -y git libaio1 make cmake python-numpy python-dev software-properties-common libc6-dev libfreetype6-dev
sudo apt-get install -y libcairo2-dev flex bison libfcgi-dev libxml2 libxml2-dev bzip2 libgdal-dev apache2 protobuf-c-compiler libprotobuf-c0-dev
# For PHP MapScripts
apt-get install -y php7.0-dev
# download and compile SWIG 3.0.12
sudo wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz
tar xf swig-3.0.12.tar.gz
cd swig-3.0.12 && ./configure --prefix=/usr && make && sudo make install
swig -version
mkdir /build
cd /build
sudo git clone https://github.com/mapserver/mapserver.git mapserver
cd /build/mapserver
sudo git checkout branch-7-4
sudo mkdir /build/mapserver/build
cd /build/mapserver/build
sudo cmake .. -DCMAKE_BUILD_TYPE=Release \
-DWITH_CLIENT_WFS=ON \
-DWITH_CLIENT_WMS=ON \
-DWITH_CURL=ON \
-DWITH_GDAL=ON \
-DWITH_GIF=ON \
-DWITH_ICONV=ON \
-DWITH_KML=ON \
-DWITH_LIBXML2=ON \
-DWITH_OGR=ON \
-DWITH_ORACLESPATIAL=OFF \
-DWITH_POINT_Z_M=ON \
-DWITH_PROJ=ON \
-DWITH_SOS=ON \
-DWITH_THREAD_SAFETY=ON \
-DWITH_WCS=ON \
-DWITH_WFS=ON \
-DWITH_WMS=ON \
-DWITH_FCGI=OFF \
-DWITH_FRIBIDI=OFF \
-DWITH_CAIRO=OFF \
-DWITH_POSTGRES=OFF \
-DWITH_HARFBUZZ=OFF \
-DWITH_POSTGIS=OFF \
-DWITH_PYTHON=ON \
-DWITH_PHPNG=ON \
-DWITH_PHP=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
../
make
make installTo test the install:
- Edit /etc/php/7.0/cli/php.ini and set
enable_dl=On(line 733)
Run the following:
php -a
dl("libphp_mapscriptng.so");
echo mapscript.msGetVersion();
This should output text such as:
PHP Notice: Use of undefined constant mapscript - assumed 'mapscript' in php shell code on line 1 mapscript MapServer version 7.4.0-beta2 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M SUPPORTS=PBF INPUT=JPEG INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
To get PHP config info:
php -a
echo phpinfo();
