[mapguide-commits] r4626 - in sandbox/adsk/2.2gp/Web/src: PhpApi PhpMapGuideApiEnvConfig

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Mar 3 18:35:34 EST 2010


Author: brucedechant
Date: 2010-03-03 18:35:33 -0500 (Wed, 03 Mar 2010)
New Revision: 4626

Modified:
   sandbox/adsk/2.2gp/Web/src/PhpApi/PhpApi.vcproj
   sandbox/adsk/2.2gp/Web/src/PhpApi/php.i
   sandbox/adsk/2.2gp/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
Log:
Fix for trac ticket 1290 - Update PHP extensions to support PHP 5.3
http://trac.osgeo.org/mapguide/ticket/1290

Notes:
- Modified extension project and source code to support both PHP 5.2 and PHP 5.3
- Added missing phpinfo to both extensions


Modified: sandbox/adsk/2.2gp/Web/src/PhpApi/PhpApi.vcproj
===================================================================
--- sandbox/adsk/2.2gp/Web/src/PhpApi/PhpApi.vcproj	2010-03-03 14:35:05 UTC (rev 4625)
+++ sandbox/adsk/2.2gp/Web/src/PhpApi/PhpApi.vcproj	2010-03-03 23:35:33 UTC (rev 4626)
@@ -46,7 +46,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\HttpHandler;..\WebApp;..\WebSupport;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml-2.3.10\xerces-c-src\src;..\..\..\Oem\php;..\..\..\Oem\php\main;..\..\..\Oem\php\TSRM;..\..\..\Oem\php\Zend;..\..\..\Oem\php\ext\w32api"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PHPPROXYAPI_EXPORTS;ZEND_WIN32;PHP_WIN32;ZEND_DEBUG=0;ZTS=1;PHP"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PHPPROXYAPI_EXPORTS;ZEND_WIN32;PHP_WIN32;ZEND_DEBUG=0;ZTS=1;PHP;_USE_32BIT_TIME_T"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
 				BasicRuntimeChecks="3"
@@ -207,7 +207,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				AdditionalIncludeDirectories="..\HttpHandler;..\WebApp;..\WebSupport;..\..\..\Common\MdfModel;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Oem\ACE\ACE_wrappers;..\..\..\Oem\dbxml-2.3.10\xerces-c-src\src;..\..\..\Oem\php;..\..\..\Oem\php\main;..\..\..\Oem\php\TSRM;..\..\..\Oem\php\Zend;..\..\..\Oem\php\ext\w32api"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PHPPROXYAPI_EXPORTS;ZEND_WIN32;PHP_WIN32;ZEND_DEBUG=0;ZTS=1;PHP"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PHPPROXYAPI_EXPORTS;ZEND_WIN32;PHP_WIN32;ZEND_DEBUG=0;ZTS=1;PHP;_USE_32BIT_TIME_T"
 				ExceptionHandling="2"
 				RuntimeLibrary="2"
 				WarningLevel="3"

Modified: sandbox/adsk/2.2gp/Web/src/PhpApi/php.i
===================================================================
--- sandbox/adsk/2.2gp/Web/src/PhpApi/php.i	2010-03-03 14:35:05 UTC (rev 4625)
+++ sandbox/adsk/2.2gp/Web/src/PhpApi/php.i	2010-03-03 23:35:33 UTC (rev 4626)
@@ -165,6 +165,11 @@
 }
 typedef char* CHAR_PTR_NOCOPY;
 
+%pragma(php) phpinfo=
+"    php_info_print_table_start();\n"\
+"    php_info_print_table_row(2, \"MapGuideApi\", \"enabled\");\n"\
+"    php_info_print_table_end();"
+
 ///////////////////////////////////////////////////////////
 // Global functions
 //

Modified: sandbox/adsk/2.2gp/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
===================================================================
--- sandbox/adsk/2.2gp/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp	2010-03-03 14:35:05 UTC (rev 4625)
+++ sandbox/adsk/2.2gp/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp	2010-03-03 23:35:33 UTC (rev 4626)
@@ -16,42 +16,31 @@
 //
 
 #pragma once
-/* PHP Extension headers */
-/* include zend win32 config first */
-#ifdef _WIN64
-//#include "zend_config.w64.h" // x64 configuration doesn't exist yet
-#else
-#include "zend_config.w32.h"
-#endif
 
-/* include standard header */
+/* PHP Extension headers */
 #include "php.h"
+#include "ext/standard/info.h"
 
-#include <windows.h>
-
 #pragma warning(disable: 4996)
 
 
 #define GETENV GetEnvironmentVariable
 #define SETENV SetEnvironmentVariable
 
-wchar_t g_phpPath[MAX_PATH] = L"";
-
 BOOL PrepareServerPath()
 {
+    wchar_t phpPath[MAX_PATH] = L"";
+
     // Get the location of PHP
     HMODULE hModule;
-    GetModuleHandleEx(0, L"php5ts.dll", &hModule);
-    GetModuleFileName(hModule, g_phpPath, MAX_PATH);
-    wcsrchr(g_phpPath, '\\')[0] = '\0';
-    FreeLibrary(hModule);
+    hModule = GetModuleHandle(L"php5ts.dll");
+    GetModuleFileName(hModule, phpPath, MAX_PATH);
+    wcsrchr(phpPath, '\\')[0] = '\0';
+//    FreeLibrary(hModule);  -- DO NOT CALL FreeLibrary() when using GetModuleHandle() as the reference count is not increased
 
     // Prepend to process PATH environment string
-    wchar_t srvPath[MAX_PATH] = L"";
-    wcscpy(srvPath, g_phpPath);
-
-    wchar_t ePath[1024*4] = {0};
-    wcscpy(ePath, srvPath);
+    wchar_t ePath[1024*4] = L"";
+    wcscpy(ePath, phpPath);
     wcscat(ePath, L";");
     DWORD dw = (DWORD)wcslen(ePath);
     return (GETENV(L"PATH", &ePath[dw], sizeof(ePath)-dw) &&
@@ -73,70 +62,42 @@
 
 ZEND_FUNCTION(LoadMgDlls);
 /* compiled function list so Zend knows what's in this module */
-zend_function_entry CustomExtModule_functions[] = {
-    ZEND_FE(LoadMgDlls, NULL)
+zend_function_entry MapGuideApiEnvConfig_functions[] = {
     {NULL, NULL, NULL}
 };
 
 
-PHP_MINIT_FUNCTION(CustomExtModule)
+PHP_MINIT_FUNCTION(MapGuideApiEnvConfig)
 {
     return SUCCESS;
 }
 
+PHP_MSHUTDOWN_FUNCTION(MapGuideApiEnvConfig)
+{
+    return SUCCESS;
+}
 
+PHP_MINFO_FUNCTION(MapGuideApiEnvConfig)
+{
+    php_info_print_table_start();
+    php_info_print_table_row(2, "MapGuideApiEnvConfig", "enabled");
+    php_info_print_table_end();
+}
+
 /* compiled module information */
-zend_module_entry CustomExtModule_module_entry = {
+zend_module_entry MapGuideApiEnvConfig_module_entry = {
     STANDARD_MODULE_HEADER,
-    "MapGuideApiEnvConfig Module",
-    CustomExtModule_functions,
-    PHP_MINIT(CustomExtModule), NULL, NULL, NULL, NULL,
-    NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
+    "MapGuideApiEnvConfig",
+    MapGuideApiEnvConfig_functions,
+    PHP_MINIT(MapGuideApiEnvConfig),
+    PHP_MSHUTDOWN(MapGuideApiEnvConfig),
+    NULL,
+    NULL,
+    PHP_MINFO(MapGuideApiEnvConfig),
+    NO_VERSION_YET,
+    STANDARD_MODULE_PROPERTIES
 };
 
 
 /* implement standard "stub" routine to introduce ourselves to Zend */
-ZEND_GET_MODULE(CustomExtModule)
-
-
-/* LoadMgDlls function */
-ZEND_FUNCTION(LoadMgDlls)
-{
-    long theValue = 0;
-
-    SetDllDirectory(g_phpPath);
-
-    // Load the dependent dlls
-
-#ifdef _DEBUG
-
-    LoadLibrary(L"ACEd.dll");
-    LoadLibrary(L"lib_jsond.dll");
-    LoadLibrary(L"MgFoundationd.dll");
-    LoadLibrary(L"MgGeometryd.dll");
-    LoadLibrary(L"MgHttpHandlerd.dll");
-    LoadLibrary(L"MgMapGuideCommond.dll");
-    LoadLibrary(L"MgMdfModeld.dll");
-    LoadLibrary(L"MgMdfParserd.dll");
-    LoadLibrary(L"MgPlatformBased.dll");
-    LoadLibrary(L"MgWebAppd.dll");
-    LoadLibrary(L"xerces-c_2_7d.dll");
-
-#else
-
-    LoadLibrary(L"ACE.dll");
-    LoadLibrary(L"lib_json.dll");
-    LoadLibrary(L"MgFoundation.dll");
-    LoadLibrary(L"MgGeometry.dll");
-    LoadLibrary(L"MgHttpHandler.dll");
-    LoadLibrary(L"MgMapGuideCommon.dll");
-    LoadLibrary(L"MgMdfModel.dll");
-    LoadLibrary(L"MgMdfParser.dll");
-    LoadLibrary(L"MgPlatformBase.dll");
-    LoadLibrary(L"MgWebApp.dll");
-    LoadLibrary(L"xerces-c_2_7.dll");
-
-#endif
-
-    RETURN_LONG(theValue);
-}
+ZEND_GET_MODULE(MapGuideApiEnvConfig)



More information about the mapguide-commits mailing list