Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 2.13 KB

README.md

File metadata and controls

52 lines (35 loc) · 2.13 KB

PHP wrapper notes

This document describes the PHP language binding for the MapGuide API

Supported PHP version

This binding targets the Windows release of PHP 7.1.19, the current PHP version in the 7.1 series.

The binding is built against the non-thread-safe release of PHP, meaning it currently can only be used in Apache httpd server via FastCGI with the mod_fcgid module

No binding is provided for PHP 7.1 on Linux at this point in time as none of the Linux distros where we provide MapGuide binaries for (CentOS 6.x / Ubuntu 14.04), provide an official PHP 7.x package.

Usage

NOTE:

As MapGuide currently does not bundle PHP 7.1, these instructions assume you already have PHP 7.1 installed. How to install PHP 7.1 is beyond the scope of this document

  1. Copy php_MapGuideApi.dll and supporting dlls to the ext subdirectory of your PHP 7.1 installation.
  2. Modify php.ini and add the line extension=php_MapGuideApi.dll to the extensions section of the file.

Known issues

  • Some APIs with many overloads may have incorrect wrapper code generated by vanilla SWIG. We've been working around this by monkey-patching away such problematic APIs. Please report any APIs that do not behave as they did in the official PHP 5.x binding.

  • If you have multiple try/catch blocks within the same scope, make sure to use different exception variable names. For example:

try {
  //Some code that throws
} catch (MgException $ex) {
  //Handle this exception
}

try {
  //Some more code that throws
} catch (MgException $ex) {
  //$ex from previous catch block is not properly cleaned up and will leak memory. You should use a different variable name here
}

Differences from the official PHP binding

  • Usage

    • You will need to include MapGuideApi.php to access the MapGuide API.
  • Removed classes/APIs

    • MgLayerBase::MgLayerBase
    • MgMapBase::Open
    • MgResource::Save
    • MgConfigurationException::GetExceptionMessage
    • MgSerializable This is only a "marker" class for server/webtier serialization plumbing. Needed to be removed so that MgException can be rebased against PHP Exception to make it throwable.