Skip to content

Commit 1534710

Browse files
AlexanderGabrieltbonfort
authored andcommitted
Update README.WIN32 for Mapserver and PHP/MapScript (MapServer#5357)
1 parent 0f9ece8 commit 1534710

File tree

2 files changed

+119
-104
lines changed

2 files changed

+119
-104
lines changed

README.WIN32

Lines changed: 87 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,108 @@ IMPORTANT - READ THIS FIRST:
2222

2323
--------------------------------------------------------------------
2424

25-
For the developers using MSVC++, a NMAKE makefile (Makefile.vc + nmake.opt)
26-
to build the MapServer library and executable programs is included with
27-
the distribution.
25+
The easyest way to build Mapserver on Windows on your own is to use the
26+
build-system from http://gisinternals.com/.
27+
GISInternals provide a complete set of sources and dependencies and even
28+
makefiles for the full version of Visual Studio (not Express oder Community).
29+
You don't have to download and compile them all by your own.
30+
31+
If you are not using full version of Visual Studio you can not use the makefiles
32+
from GISInternals but you can still use the downloads to make your life easier.
33+
34+
Building with the full version of Visual Studio is easy.
35+
Download the SDK for you version and follow the readme inside the packages.
36+
37+
This Readme will cover the compilation with Visual Studio 2012 Express on
38+
Windows with CMake and the GISInternals-Packages for the following reasons:
39+
- not everybody wants to buy Visual Studio and there is no reason to force
40+
you to buy it just tu build Mapserver on Windows
41+
- CMake is the configuration-system for Linux. Why should you use something
42+
else which needs to be maintainerd?
43+
- as of today, PHP-Mapscript is not suppored for PHP-7. PHP-5.6 is build
44+
with VC11. To make PHP-Mapscript compatible with the downloadable
45+
PHP-Version you need to build with VC11 wich is Visual Studio 2012.
46+
- GISInternals Downloads contain most dependencies. it's way easier
47+
48+
If you want to compile Mapserver with any other version of Visual Studio you
49+
can for sure use this documentation as help but maybe, some things here won't
50+
work for you.
2851

29-
To build the package using the Makefile.vc and NMAKE:
52+
--------------------------------------------------------------------
53+
Prerequisites
54+
--------------------------------------------------------------------
55+
56+
To build Mapserver on Windows with Visual Studio 2012 Express you need
57+
Visual Studio 2012 Express installed.
58+
Install CMake (https://cmake.org/) and add CMake bin-directory to your PATH
59+
environment variable. You can even to this after opening VS2012 x86 Native
60+
Tools Command Prompt by entering:
61+
set PATH=%PATH%;"C:\Program Files\CMake\bin"
62+
... if CMake is installed to "C:\Program Files\CMake" ;)
3063

31-
- Edit nmake.opt to select (or deselect) optional components of
32-
the MapServer. Please read the notes below about each component
33-
before you move ahead with the compilation.
64+
--------------------------------------------------------------------
65+
Downloading dependencies
66+
--------------------------------------------------------------------
3467

35-
- Open a DOS prompt window
68+
For our first build, we will use stable releases to build mapserver.
69+
Download MSVC 2012 win32 Packages for GDAL-2.1.2 and Mapserver-7.0.2 from http://gisinternals.com/release.php.
70+
We need "Compiled binaries in a single .zip package", "GDAL and MapServer sources" and "Compiled libraries and headers".
71+
Download the MSVC 2012 win32 Developement Kit from http://gisinternals.com/sdk.php.
72+
Extract everything to C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2.
73+
There should be the directories inside now: bin, doc, gdal, include, lib, regex-0.12, relase-1700, ...
74+
After you got this done, feel free to use other packages which fit your needs better.
3675

37-
- Run the VCVARS32.BAT script to initialize the VC++ environment
38-
variables. VCVARS32.BAT is automatically generated by the MSVC++
39-
install procedure and should be located in the BIN sub-directory of
40-
your MSVC++ installation.
76+
--------------------------------------------------------------------
77+
Mapserver-sources
78+
--------------------------------------------------------------------
4179

42-
- Then start the build with:
43-
nmake /f Makefile.vc
80+
Download at least Mapserver-7.0.3 or current 7.0-Branch from github
81+
and extract or clone from github to C:\dev\work\mapserver.
4482

45-
This will create "mapserv.exe" (the main MapServer CGI program), the
46-
other command-line utilities, "mapserver.lib" and "libmap.dll" that is
47-
used by theMapScript modules.
83+
--------------------------------------------------------------------
84+
Building Mapserver
85+
--------------------------------------------------------------------
4886

87+
After downloading and extracting everything, to build Mapserver, follow this steps:
88+
1. Open VS2012 x86 Native Tools Command Prompt (i'm german, hope it is translated
89+
correctly).
90+
2. Add CMake-bin to your PATH:
91+
set PATH=%PATH%;"C:\Program Files\CMake\bin"
92+
3. Create build-Directory:
93+
mkdir C:\dev\work\mapserver\build
94+
cd C:\dev\work\mapserver\build
95+
4. Configure:
96+
cmake .. -G "NMake Makefiles" -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -Wno-dev
97+
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
98+
cmake .. -DREGEX_DIR=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\regex-0.12
99+
cmake .. -DWITH_POSTGIS=0 -DWITH_SOS=1 -DWITH_KML=1
100+
cmake .. -DWITH_CLIENT_WMS=1 -DWITH_CLIENT_WFS=1
101+
cmake .. -DWITH_THREAD_SAFETY=1 -DWITH_FCGI=1
102+
cmake .. -DWITH_CAIRO=1 -DCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\cairo.lib
103+
cmake .. -DWITH_SVGCAIRO=1 -DSVGCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg-cairo.lib
104+
cmake .. -DSVG_LIBRARY=1 -DSVG_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg.lib
105+
5. build
106+
nmake
107+
108+
Thats it.
109+
You can use all CMake parameters and options as you are used from CMake to fit mapserver to your needs from here.
110+
Enjoy!
49111

50112
--------------------------------------------------------------------
51113
MapScript
52114
--------------------------------------------------------------------
53115

54116
To compile the various versions of MapScript (Perl, PHP, etc) first compile
55-
the main mapserver directory and then see the README files in the
56-
mapscript/perl, mapscript/php3 or mapscript/python directory for specific
117+
the main mapserver directory and then see the README files in the
118+
mapscript/perl, mapscript/php or mapscript/python directory for specific
57119
instructions.
58120

121+
--------------------------------------------------------------------
122+
Dependencies Part 2
123+
--------------------------------------------------------------------
124+
125+
The following sections descripe how to get mapserver dependencies when not
126+
downloading GISInternals packages.
59127

60128
--------------------------------------------------------------------
61129
GD library
@@ -168,27 +236,6 @@ instructions.
168236
with the PNG support, make sure that the libpng that you use in mapserver
169237
is the same as the one used in GDAL.
170238

171-
------------------------------------------------------------
172-
Notes on PDF suuport
173-
------------------------------------------------------------
174-
175-
The PDF support allows the output of a map file as a PDF file.
176-
177-
To be able to build mapserver with the PDF support, you need to download
178-
and build a PDF library from www.pdflib.com (http://www.pdflib.com/pdflib/download/index.html).
179-
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 :
180-
181-
1) Build the PDF lib
182-
183-
- open the project PDFLib.dsw
184-
- build the project pdflib_dll
185-
- after a sucessful build, you should have a pdflib.lib and pdblib.dll under the
186-
pdflib directory
187-
- copy the pdflib.dll under your system directory (ex : c:/winnt/system32)
188-
189-
2) Build mapserver with PDF
190-
191-
- uncomment in the nmake.opt the flags related to PDF
192239

193240

194241
$Id$

mapscript/php/README.WIN32

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,63 @@
11
PHP/MapScript Mapserver Module
22
==============================
33

4-
--------------------------------------------------------------------
5-
IMPORTANT - READ THIS FIRST:
6-
7-
The Win32 build process is not very friendly for unexperienced users.
8-
So it is strongly recommended that you use one of the precompiled
9-
versions of php_mapscript.dll available on DM Solutions Group's web site:
10-
http://www2.dmsolutions.ca/mapserver/dl/
11-
12-
If for some reason you still decide to compile Win32 binaries yourself,
13-
then don't do it unless you really know what you're doing... and
14-
hopefully the rest of this file contains some hints that may help
15-
you. Good Luck!
16-
--------------------------------------------------------------------
17-
18-
This file contains informations specific to building the PHP/MapScript
19-
extension on Windows using MSVC++ 6.0.
4+
This README covers building PHP-Mapscript on Windows with Visual Studio 2012 Express for PHP-5.6 x86 Thread-Safe.
205

21-
See also the file README for more general information about the
22-
PHP/MapScript extension.
6+
If you already built Mapserver with instructions from ../../README.WIN32, you are only a few steps away from PHP-Mapscript.
7+
If not, first build Mapserver as descriped in ../../README.WIN32.
238

24-
--------------------------
259

26-
Step 1: Build the PHP.LIB import library
27-
=======
28-
29-
*** PHP3 ***
30-
Before you can build the 'php3_mapscript.dll' extension, you need the
31-
PHP.LIB import library. To build PHP.LIB, you will have to download the
32-
php_3.0.14.tar.gz source code, and follow the instructions in the
33-
README.WIN32 file in there to build php.exe with MSVC++ 6.0.
34-
35-
- Extract php_3.0.14.tar.gz to your HD
36-
- Read the php_3.0.14\README.WIN32 file.
37-
- Open php_3.0.14\win32\php3.dsw using MSVC++ 6.0
38-
- Start building php.exe, this will also create PHP.LIB
39-
40-
*** PHP4.0.4 (and more recent versions) ***
41-
The PHP 4.0.4 win32 binaries (php-4.0.4-Win32.zip) distributed on
42-
http://www.php.net/ include the necessary php4ts.lib import library,
43-
so it is not necessary to build the PHP4 source in this case:
44-
- Extract php-4.0.4.tar.gz (this will create a php-4.0.4 source tree)
45-
- Extract php-4.0.4-Win32.zip and configure PHP4 on your server as per
46-
the instructions in the file install.txt included in the zip file.
47-
- mkdir php-4.0.4\lib (i.e. 'mkdir lib' in the root of the source tree)
48-
- Copy php4ts.lib (from php-4.0.4-Win32.zip) to php-4.0.4\lib
49-
- Continue with the rest of the instructions below.
10+
--------------------------------------------------------------------
11+
Step 1: Build PHP
12+
--------------------------------------------------------------------
5013

51-
Step 2: Build PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL
52-
=======
14+
Build PHP-5.6 x86 Thread-Safe with Visual Studio 2012 Express as descriped here: https://wiki.php.net/internals/windows/stepbystepbuild
15+
Extract the PHP-SDK to C:\dev\work\php-sdk to be able to use the commands, used here.
5316

54-
Review the mapscript\php3\makefile.vc and make any modifications required
55-
for your configuration. Make sure PHP_SOURCE_DIR points to where you
56-
installed the PHP source tree in step 1 above.
17+
PHP sources and compiled binaries should be in C:\dev\work\php-sdk\phpdev\vc11\x86\php-5.6.28-src now.
5718

58-
Then to compile PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL:
5919

60-
- Open a DOS prompt window
61-
- Run the VCVARS32.BAT script to initialize the VC++ environment
62-
variables. VCVARS32.BAT is automatically generated by the MSVC++
63-
install procedure and should be located in the BIN sub-directory of
64-
your MSVC++ installation.
65-
- Then start the build with:
66-
nmake /f makefile.vc
20+
--------------------------------------------------------------------
21+
Step 2: Build PHP-Mapscript
22+
--------------------------------------------------------------------
6723

68-
This will create the "PHP3_MAPSCRIPT.DLL" for PHP3, or "PHP_MAPSCRIPT.DLL"
69-
for PHP4.
24+
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).
25+
If not, open VS2012 x86 Native Tools Shell, add cmake to your PATH (see ../../README.WIN32) and "cd C:\dev\work\mapserver\build".
26+
1. Tell CMake to build Mapscript by entering:
27+
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
28+
2. build:
29+
nmake
7030

7131

32+
--------------------------------------------------------------------
7233
Step 3: Install PHP3_MAPSCRIPT.DLL/PHP_MAPSCRIPT.DLL
73-
=======
34+
--------------------------------------------------------------------
7435

75-
PHP3_MAPSCRIPT.DLL is a regular PHP module, you should copy it to the same
76-
directory as the other PHP3_*.DLL modules that came with PHP.
36+
PHP_MAPSCRIPT.DLL is a regular PHP module, you should copy it to the same
37+
directory as the other PHP_*.DLL modules that came with PHP.
7738

7839
Then the module can be loaded in one of 2 ways:
7940

80-
- Adding a "extension=php3_mapscript.dll" line to the PHP3.INI file will
41+
- Adding a "extension=php_mapscript.dll" line to the PHP3.INI file will
8142
load it automatically for every PHP page.
8243

8344
- The other possibility is to load the module only when needed using the
8445
following PHP call:
85-
dl("php3_mapscript.dll"); // for the PHP3 module
86-
or
8746
dl("php_mapscript.dll"); // for the PHP4 module
8847

8948
You can test that the module is properly loaded by executing the
9049
phpinfo() command in a PHP page... the "MapScript" extension should be
9150
included in the list of extensions in the phpinfo() report.
9251

52+
--------------------------------------------------------------------
53+
Maybe Step 4: Troubleshooting
54+
--------------------------------------------------------------------
55+
56+
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.
57+
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.
58+
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.
59+
Open php_mapscript.dll with Dependency Walker to see missing dependencies.
60+
9361

9462
--------------------------
9563
$Id$

0 commit comments

Comments
 (0)