php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #51536
Patch inipath_patch53 revision 2010-05-01 18:33 UTC by ksingla@php.net
Patch define_phpdll_patch_53 revision 2010-05-01 18:31 UTC by ksingla@php.net

Patch inipath_patch53 for *Configuration Issues Bug #51536

Patch version 2010-05-01 18:33 UTC

Return to Bug #51536 | Download this patch
Patch Revisions:

Developer: ksingla@php.net

Index: php_ini.c
===================================================================
--- php_ini.c	(revision 298105)
+++ php_ini.c	(working copy)
@@ -395,6 +395,7 @@
 		char *binary_location;
 		static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
 #ifdef PHP_WIN32
+		HMODULE hmodule;
 		char *reg_location;
 #endif
 
@@ -443,7 +444,24 @@
 
 		/* Add binary directory */
 #ifdef PHP_WIN32
+		/* Add location where php is installed */
 		binary_location = (char *) emalloc(MAXPATHLEN);
+
+		hmodule = GetModuleHandle(PHP_DLLNAME);
+		if (hmodule != NULL) {
+			if(GetModuleFileName(hmodule, binary_location, MAXPATHLEN) != 0) {
+				char *separator_location = strrchr(binary_location, DEFAULT_SLASH);
+
+				if (separator_location && separator_location != binary_location) {
+					*(separator_location) = 0;
+				}
+				if (*php_ini_search_path) {
+					strlcat(php_ini_search_path, paths_separator, search_path_size);
+				}
+				strlcat(php_ini_search_path, binary_location, search_path_size);
+			}
+		}
+
 		if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) {
 			efree(binary_location);
 			binary_location = NULL;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC