                    PHP/MapScript Mapserver Module
                    ==============================

This README covers building PHP-Mapscript on Windows with Visual Studio 2012 Express for PHP-5.6 x86 Thread-Safe.

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 PHP
--------------------------------------------------------------------

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.

PHP sources and compiled binaries should be in C:\dev\work\php-sdk\phpdev\vc11\x86\php-5.6.28-src now.


--------------------------------------------------------------------
Step 2: Build PHP-Mapscript
--------------------------------------------------------------------

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
--------------------------------------------------------------------

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=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("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$
--------------------------
