function config_apache_php_module($PHPDEVSERVER_PATH, $php_version) { $conf_file = "{$PHPDEVSERVER_PATH}/Apache24/conf.d/50-php.conf"; preg_replace_file($conf_file, "/FcgidInitialEnv.*PHPRC.*/i", "FcgidInitialEnv PHPRC " . "\"" . cpath("{$PHPDEVSERVER_PATH}/{$php_version}") . "\""); preg_replace_file($conf_file, "/FcgidInitialEnv.*PHP_INI_SCAN_DIR.*/i", "FcgidInitialEnv PHP_INI_SCAN_DIR " . "\"" . cpath("{$PHPDEVSERVER_PATH}/{$php_version}/conf.apache.d") . "\""); preg_replace_file($conf_file, "/FcgidInitialEnv.*MAGICK_HOME.*/i", "FcgidInitialEnv MAGICK_HOME " . "\"" . cpath("{$PHPDEVSERVER_PATH}/ImageMagick/bin") . "\""); preg_replace_file($conf_file, "/FcgidInitialEnv\\s+TEMP .*/i", "FcgidInitialEnv TEMP " . "\"" . cpath(getenv("SystemRoot") . "\\Temp") . "\""); preg_replace_file($conf_file, "/FcgidInitialEnv\\s+TMP .*/i", "FcgidInitialEnv TMP " . "\"" . cpath(getenv("SystemRoot") . "\\Temp") . "\""); preg_replace_file($conf_file, "/FcgidWrapper\\s+.*\\s+\\.php/i", "FcgidWrapper " . "\"" . cpath("{$PHPDEVSERVER_PATH}/{$php_version}/php-cgi.exe") . "\"" . " .php"); }
if (file_exists($conf_file)) { preg_replace_file($conf_file, '/Define SRVROOT \\"\\/Apache24\\"/i', 'Define SRVROOT "' . cpath($PHPDEVSERVER_HOME) . '/Apache24"'); } echo "OK" . PHP_EOL; // Replace all php fcgid setting echo "Configuring PHP as Apache fcgid module ... "; $php_version = @getenv("PHPDEVSERVER_PHP_VERSION"); if (!$php_version) { $php_version = "php56"; } config_apache_php_module($PHPDEVSERVER_HOME, $php_version); echo "OK" . PHP_EOL; echo "Configuring phpMyAdmin as Apache alias path ... "; $conf_file = "{$PHPDEVSERVER_HOME}/Apache24/conf.d/51-phpmyadmin.conf"; preg_replace_file($conf_file, "/Alias.*\\/phpmyadmin.*/", "Alias /phpmyadmin " . "\"" . cpath("{$PHPDEVSERVER_HOME}/phpmyadmin") . "\""); preg_replace_file($conf_file, "/<Directory \\\".*\\\">/i", "<Directory \"" . cpath("{$PHPDEVSERVER_HOME}/phpmyadmin") . "\">"); echo "OK" . PHP_EOL; $registry = new Registry(); $ORIG_PATH = $registry->read('HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\Path'); if (!$ORIG_PATH) { $ORIG_PATH = getenv("PATH"); if (!$ORIG_PATH) { $ORIG_PATH = ""; } } // CHECK IF NEED Modify PATH $paths = explode(";", $ORIG_PATH); $need_modify_path = true; foreach ($paths as $p) { if (strpos($p, '%PHPDEVSERVER_PATH%') !== false) { $need_modify_path = false;