[mapguide-commits] r4751 - in trunk/MgDev/Web/src: PhpApi PhpMapGuideApiEnvConfig

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Apr 7 13:36:42 EDT 2010


Author: brucedechant
Date: 2010-04-07 13:36:42 -0400 (Wed, 07 Apr 2010)
New Revision: 4751

Modified:
   trunk/MgDev/Web/src/PhpApi/PhpApi.vcproj
   trunk/MgDev/Web/src/PhpApi/php.i
   trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
   trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.vcproj
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: trunk/MgDev/Web/src/PhpApi/PhpApi.vcproj
===================================================================
--- trunk/MgDev/Web/src/PhpApi/PhpApi.vcproj	2010-04-07 17:21:32 UTC (rev 4750)
+++ trunk/MgDev/Web/src/PhpApi/PhpApi.vcproj	2010-04-07 17:36:42 UTC (rev 4751)
@@ -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"
@@ -206,7 +206,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: trunk/MgDev/Web/src/PhpApi/php.i
===================================================================
--- trunk/MgDev/Web/src/PhpApi/php.i	2010-04-07 17:21:32 UTC (rev 4750)
+++ trunk/MgDev/Web/src/PhpApi/php.i	2010-04-07 17:36:42 UTC (rev 4751)
@@ -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: trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
===================================================================
--- trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp	2010-04-07 17:21:32 UTC (rev 4750)
+++ trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp	2010-04-07 17:36:42 UTC (rev 4751)
@@ -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) &&
@@ -71,72 +60,43 @@
 }
 
 
-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)

Modified: trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.vcproj
===================================================================
--- trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.vcproj	2010-04-07 17:21:32 UTC (rev 4750)
+++ trunk/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.vcproj	2010-04-07 17:36:42 UTC (rev 4751)
@@ -45,7 +45,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\..\Oem\php\main;..\..\..\Oem\php\Zend;..\..\..\Oem\php\TSRM;..\..\..\Oem\php\regex;..\..\..\Oem\php"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PHPMAPGUIDEAPIENVCONFIG_EXPORTS;ZEND_DEBUG=0;ZTS=1;ZEND_WIN32;PHP_WIN32"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PHPMAPGUIDEAPIENVCONFIG_EXPORTS;ZEND_DEBUG=0;ZTS=1;ZEND_WIN32;PHP_WIN32;_USE_32BIT_TIME_T"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -202,7 +202,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="..\..\..\Oem\php\main;..\..\..\Oem\php\Zend;..\..\..\Oem\php\TSRM;..\..\..\Oem\php\regex;..\..\..\Oem\php"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PHPMAPGUIDEAPIENVCONFIG_EXPORTS;ZEND_DEBUG=0;ZTS=1;ZEND_WIN32;PHP_WIN32"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PHPMAPGUIDEAPIENVCONFIG_EXPORTS;ZEND_DEBUG=0;ZTS=1;ZEND_WIN32;PHP_WIN32;_USE_32BIT_TIME_T"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				WarningLevel="3"



More information about the mapguide-commits mailing list