Permalink
Browse files

Update README.WIN32 for Mapserver and PHP/MapScript (#5357)

  • Loading branch information...
AlexanderGabriel authored and tbonfort committed Dec 7, 2016
1 parent 0f9ece8 commit 153471013be25562ebb3d83f17b7312834e3a4fd
Showing with 119 additions and 104 deletions.
  1. +87 −40 README.WIN32
  2. +32 −64 mapscript/php/README.WIN32
View
@@ -22,40 +22,108 @@ IMPORTANT - READ THIS FIRST:
--------------------------------------------------------------------
For the developers using MSVC++, a NMAKE makefile (Makefile.vc + nmake.opt)
to build the MapServer library and executable programs is included with
the distribution.
The easyest way to build Mapserver on Windows on your own is to use the
build-system from http://gisinternals.com/.
GISInternals provide a complete set of sources and dependencies and even
makefiles for the full version of Visual Studio (not Express oder Community).
You don't have to download and compile them all by your own.
If you are not using full version of Visual Studio you can not use the makefiles
from GISInternals but you can still use the downloads to make your life easier.
Building with the full version of Visual Studio is easy.
Download the SDK for you version and follow the readme inside the packages.
This Readme will cover the compilation with Visual Studio 2012 Express on
Windows with CMake and the GISInternals-Packages for the following reasons:
- not everybody wants to buy Visual Studio and there is no reason to force
you to buy it just tu build Mapserver on Windows
- CMake is the configuration-system for Linux. Why should you use something
else which needs to be maintainerd?
- as of today, PHP-Mapscript is not suppored for PHP-7. PHP-5.6 is build
with VC11. To make PHP-Mapscript compatible with the downloadable
PHP-Version you need to build with VC11 wich is Visual Studio 2012.
- GISInternals Downloads contain most dependencies. it's way easier
If you want to compile Mapserver with any other version of Visual Studio you
can for sure use this documentation as help but maybe, some things here won't
work for you.
To build the package using the Makefile.vc and NMAKE:
--------------------------------------------------------------------
Prerequisites
--------------------------------------------------------------------
To build Mapserver on Windows with Visual Studio 2012 Express you need
Visual Studio 2012 Express installed.
Install CMake (https://cmake.org/) and add CMake bin-directory to your PATH
environment variable. You can even to this after opening VS2012 x86 Native
Tools Command Prompt by entering:
set PATH=%PATH%;"C:\Program Files\CMake\bin"
... if CMake is installed to "C:\Program Files\CMake" ;)
- Edit nmake.opt to select (or deselect) optional components of
the MapServer. Please read the notes below about each component
before you move ahead with the compilation.
--------------------------------------------------------------------
Downloading dependencies
--------------------------------------------------------------------
- Open a DOS prompt window
For our first build, we will use stable releases to build mapserver.
Download MSVC 2012 win32 Packages for GDAL-2.1.2 and Mapserver-7.0.2 from http://gisinternals.com/release.php.
We need "Compiled binaries in a single .zip package", "GDAL and MapServer sources" and "Compiled libraries and headers".
Download the MSVC 2012 win32 Developement Kit from http://gisinternals.com/sdk.php.
Extract everything to C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2.
There should be the directories inside now: bin, doc, gdal, include, lib, regex-0.12, relase-1700, ...
After you got this done, feel free to use other packages which fit your needs better.
- Run the VCVARS32.BAT script to initialize the VC++ environment
variables. VCVARS32.BAT is automatically generated by the MSVC++
install procedure and should be located in the BIN sub-directory of
your MSVC++ installation.
--------------------------------------------------------------------
Mapserver-sources
--------------------------------------------------------------------
- Then start the build with:
nmake /f Makefile.vc
Download at least Mapserver-7.0.3 or current 7.0-Branch from github
and extract or clone from github to C:\dev\work\mapserver.
This will create "mapserv.exe" (the main MapServer CGI program), the
other command-line utilities, "mapserver.lib" and "libmap.dll" that is
used by theMapScript modules.
--------------------------------------------------------------------
Building Mapserver
--------------------------------------------------------------------
After downloading and extracting everything, to build Mapserver, follow this steps:
1. Open VS2012 x86 Native Tools Command Prompt (i'm german, hope it is translated
correctly).
2. Add CMake-bin to your PATH:
set PATH=%PATH%;"C:\Program Files\CMake\bin"
3. Create build-Directory:
mkdir C:\dev\work\mapserver\build
cd C:\dev\work\mapserver\build
4. Configure:
cmake .. -G "NMake Makefiles" -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -Wno-dev
cmake .. -DCMAKE_PREFIX_PATH=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\bin;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\include
cmake .. -DREGEX_DIR=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\regex-0.12
cmake .. -DWITH_POSTGIS=0 -DWITH_SOS=1 -DWITH_KML=1
cmake .. -DWITH_CLIENT_WMS=1 -DWITH_CLIENT_WFS=1
cmake .. -DWITH_THREAD_SAFETY=1 -DWITH_FCGI=1
cmake .. -DWITH_CAIRO=1 -DCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\cairo.lib
cmake .. -DWITH_SVGCAIRO=1 -DSVGCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg-cairo.lib
cmake .. -DSVG_LIBRARY=1 -DSVG_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg.lib
5. build
nmake
Thats it.
You can use all CMake parameters and options as you are used from CMake to fit mapserver to your needs from here.
Enjoy!
--------------------------------------------------------------------
MapScript
--------------------------------------------------------------------
To compile the various versions of MapScript (Perl, PHP, etc) first compile
the main mapserver directory and then see the README files in the
mapscript/perl, mapscript/php3 or mapscript/python directory for specific
the main mapserver directory and then see the README files in the
mapscript/perl, mapscript/php or mapscript/python directory for specific
instructions.
--------------------------------------------------------------------
Dependencies Part 2
--------------------------------------------------------------------
The following sections descripe how to get mapserver dependencies when not
downloading GISInternals packages.
--------------------------------------------------------------------
GD library
@@ -168,27 +236,6 @@ instructions.
with the PNG support, make sure that the libpng that you use in mapserver
is the same as the one used in GDAL.
------------------------------------------------------------
Notes on PDF suuport
------------------------------------------------------------
The PDF support allows the output of a map file as a PDF file.
To be able to build mapserver with the PDF support, you need to download
and build a PDF library from www.pdflib.com (http://www.pdflib.com/pdflib/download/index.html).
The best option is to download the zip file containing the source code and build it. Please refer to the docs inside the zip for informations on how to build the library. Here are some quick notes that can help in building mapserver with PDF :
1) Build the PDF lib
- open the project PDFLib.dsw
- build the project pdflib_dll
- after a sucessful build, you should have a pdflib.lib and pdblib.dll under the
pdflib directory
- copy the pdflib.dll under your system directory (ex : c:/winnt/system32)
2) Build mapserver with PDF
- uncomment in the nmake.opt the flags related to PDF
$Id$
View
@@ -1,95 +1,63 @@
PHP/MapScript Mapserver Module
==============================
--------------------------------------------------------------------
IMPORTANT - READ THIS FIRST:
The Win32 build process is not very friendly for unexperienced users.
So it is strongly recommended that you use one of the precompiled
versions of php_mapscript.dll available on DM Solutions Group's web site:
http://www2.dmsolutions.ca/mapserver/dl/
If for some reason you still decide to compile Win32 binaries yourself,
then don't do it unless you really know what you're doing... and
hopefully the rest of this file contains some hints that may help
you. Good Luck!
--------------------------------------------------------------------
This file contains informations specific to building the PHP/MapScript
extension on Windows using MSVC++ 6.0.
This README covers building PHP-Mapscript on Windows with Visual Studio 2012 Express for PHP-5.6 x86 Thread-Safe.
See also the file README for more general information about the
PHP/MapScript extension.
If you already built Mapserver with instructions from ../../README.WIN32, you are only a few steps away from PHP-Mapscript.
If not, first build Mapserver as descriped in ../../README.WIN32.
--------------------------
Step 1: Build the PHP.LIB import library
=======
*** PHP3 ***
Before you can build the 'php3_mapscript.dll' extension, you need the
PHP.LIB import library. To build PHP.LIB, you will have to download the
php_3.0.14.tar.gz source code, and follow the instructions in the
README.WIN32 file in there to build php.exe with MSVC++ 6.0.
- Extract php_3.0.14.tar.gz to your HD
- Read the php_3.0.14\README.WIN32 file.
- Open php_3.0.14\win32\php3.dsw using MSVC++ 6.0
- Start building php.exe, this will also create PHP.LIB
*** PHP4.0.4 (and more recent versions) ***
The PHP 4.0.4 win32 binaries (php-4.0.4-Win32.zip) distributed on
http://www.php.net/ include the necessary php4ts.lib import library,
so it is not necessary to build the PHP4 source in this case:
- Extract php-4.0.4.tar.gz (this will create a php-4.0.4 source tree)
- Extract php-4.0.4-Win32.zip and configure PHP4 on your server as per
the instructions in the file install.txt included in the zip file.
- mkdir php-4.0.4\lib (i.e. 'mkdir lib' in the root of the source tree)
- Copy php4ts.lib (from php-4.0.4-Win32.zip) to php-4.0.4\lib
- Continue with the rest of the instructions below.
--------------------------------------------------------------------
Step 1: Build PHP
--------------------------------------------------------------------
Step 2: Build PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL
=======
Build PHP-5.6 x86 Thread-Safe with Visual Studio 2012 Express as descriped here: https://wiki.php.net/internals/windows/stepbystepbuild
Extract the PHP-SDK to C:\dev\work\php-sdk to be able to use the commands, used here.
Review the mapscript\php3\makefile.vc and make any modifications required
for your configuration. Make sure PHP_SOURCE_DIR points to where you
installed the PHP source tree in step 1 above.
PHP sources and compiled binaries should be in C:\dev\work\php-sdk\phpdev\vc11\x86\php-5.6.28-src now.
Then to compile PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL:
- Open a DOS prompt window
- Run the VCVARS32.BAT script to initialize the VC++ environment
variables. VCVARS32.BAT is automatically generated by the MSVC++
install procedure and should be located in the BIN sub-directory of
your MSVC++ installation.
- Then start the build with:
nmake /f makefile.vc
--------------------------------------------------------------------
Step 2: Build PHP-Mapscript
--------------------------------------------------------------------
This will create the "PHP3_MAPSCRIPT.DLL" for PHP3, or "PHP_MAPSCRIPT.DLL"
for PHP4.
After step 5 of ../../README.WIN32 you have an open VS2012 x86 Native Tools Shell in build-Directory in your Mapserver sources (C:\dev\work\mapserver\build).
If not, open VS2012 x86 Native Tools Shell, add cmake to your PATH (see ../../README.WIN32) and "cd C:\dev\work\mapserver\build".
1. Tell CMake to build Mapscript by entering:
cmake .. -DWITH_PHP=1 -DPHP5_EXTENSION_DIR=C:\dev\builds\php-5.6.28-Win32-VC11-x86_mapscript\ext -DPHP5_INCLUDES=C:\dev\work\php-sdk\phpdev\vc11\x86\php-5.6.28-src
2. build:
nmake
--------------------------------------------------------------------
Step 3: Install PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL
=======
--------------------------------------------------------------------
PHP3_MAPSCRIPT.DLL is a regular PHP module, you should copy it to the same
directory as the other PHP3_*.DLL modules that came with PHP.
PHP_MAPSCRIPT.DLL is a regular PHP module, you should copy it to the same
directory as the other PHP_*.DLL modules that came with PHP.
Then the module can be loaded in one of 2 ways:
- Adding a "extension=php3_mapscript.dll" line to the PHP3.INI file will
- Adding a "extension=php_mapscript.dll" line to the PHP3.INI file will
load it automatically for every PHP page.
- The other possibility is to load the module only when needed using the
following PHP call:
dl("php3_mapscript.dll"); // for the PHP3 module
or
dl("php_mapscript.dll"); // for the PHP4 module
You can test that the module is properly loaded by executing the
phpinfo() command in a PHP page... the "MapScript" extension should be
included in the list of extensions in the phpinfo() report.
--------------------------------------------------------------------
Maybe Step 4: Troubleshooting
--------------------------------------------------------------------
If you have any problems, getting PHP-MapScript running, add it to php.ini and try to start php from command line. It may tell you, what is missing.
PHP-MapScript has the same dependencies as Mapserver itself so you may need to add paths to the dependencies and libmap.dll/mapserver.dll to you systems PATH environment variable.
If this all does not help, use tools like SysInternals Process Monitor (https://technet.microsoft.com/de-de/sysinternals/processmonitor.aspx) or Dependency Walker (http://www.dependencywalker.com/) to find, what is missing.
Open php_mapscript.dll with Dependency Walker to see missing dependencies.
--------------------------
$Id$

0 comments on commit 1534710

Please sign in to comment.