File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1080,6 +1080,26 @@ static void *php_main(void *arg) {
10801080
10811081 sapi_startup (& frankenphp_sapi_module );
10821082
1083+ /* TODO: adapted from https://github.com/php/php-src/pull/16958, remove when merged. */
1084+ #ifdef PHP_WIN32
1085+ {
1086+ const DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
1087+ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT ;
1088+ HMODULE module ;
1089+ wchar_t filename [MAX_PATH ];
1090+ if (GetModuleHandleExW (flags , (LPCWSTR )& frankenphp_sapi_module , & module )) {
1091+ DWORD len = GetModuleFileNameW (module , filename , MAX_PATH );
1092+ if (len > 0 && len < MAX_PATH ) {
1093+ wchar_t * slash = wcsrchr (filename , L'\\' );
1094+ if (slash ) {
1095+ * slash = L'\0' ;
1096+ SetDllDirectoryW (filename );
1097+ }
1098+ }
1099+ }
1100+ }
1101+ #endif
1102+
10831103#ifdef ZEND_MAX_EXECUTION_TIMERS
10841104 /* overwrite php.ini with custom user settings */
10851105 char * php_ini_overrides = go_get_custom_php_ini (false);
You can’t perform that action at this time.
0 commit comments