UpdateExtensions() private method

private UpdateExtensions ( IEnumerable extensions ) : void
extensions IEnumerable
return void
Exemplo n.º 1
0
        private void MakeRecommendedPHPIniChanges()
        {
            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            // Set the recommended php.ini settings
            var settings = new List<PHPIniSetting>
                {
                    GetToApplyExtensionDir(),
                    GetToApplyLogErrors(),
                    GetToApplyErrorLog(file),
                    GetToApplySessionPath(file),
                    GetToApplyUploadTmpDir(file),
                    GetToApplyDateTimeZone(file),
                    GetToApplyCgiForceRedirect(),
                    GetToApplyCgiPathInfo(),
                    GetToApplyFastCgiImpersonate(),
                    new PHPIniSetting("fastcgi.logging", "0", "PHP"),
                    new PHPIniSetting("max_execution_time", "300", "PHP"),
                    new PHPIniSetting("display_errors", "Off", "PHP")
                };

            // Enable the most common PHP extensions
            var extensions = new List<PHPIniExtension>
                {
                    new PHPIniExtension("php_curl.dll", true),
                    new PHPIniExtension("php_gd2.dll", true),
                    new PHPIniExtension("php_gettext.dll", true),
                    new PHPIniExtension("php_mysql.dll", true),
                    new PHPIniExtension("php_mysqli.dll", true),
                    new PHPIniExtension("php_mbstring.dll", true),
                    new PHPIniExtension("php_openssl.dll", true),
                    new PHPIniExtension("php_soap.dll", true),
                    new PHPIniExtension("php_xmlrpc.dll", true)
                };

            file.UpdateExtensions(extensions);
            file.AddOrUpdateSettings(settings);
            file.Save(PHPIniFilePath);
        }
Exemplo n.º 2
0
        public void UpdateExtensions(IEnumerable<PHPIniExtension> extensions)
        {
            Debug.Assert(IsPHPRegistered());

            PHPIniFile file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            file.UpdateExtensions(extensions);
            file.Save(file.FileName);
        }
Exemplo n.º 3
0
        public void UpdateExtensions(IEnumerable<PHPIniExtension> extensions)
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            file.UpdateExtensions(extensions);
            file.Save(file.FileName);
        }
Exemplo n.º 4
0
        private void ApplyRecommendedPHPIniSettings()
        {
            string phpDirectory = Path.GetDirectoryName(_currentPHPHandler.ScriptProcessor);
            string handlerName = _currentPHPHandler.Name;
            string phpIniPath = GetPHPIniPath();

            PHPIniFile file = new PHPIniFile(phpIniPath);
            file.Parse();

            // Set the recommended php.ini settings
            List<PHPIniSetting> settings = new List<PHPIniSetting>();

            // Set extension directory path
            string value = Path.Combine(phpDirectory, "ext");
            settings.Add(new PHPIniSetting("extension_dir", value, "PHP"));

            // Set log_errors
            settings.Add(new PHPIniSetting("log_errors", "On", "PHP"));

            // Set error_log path
            value = Path.Combine(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\"), handlerName + "_errors.log");
            settings.Add(new PHPIniSetting("error_log", value, "PHP"));

            // Set session path
            value = Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\");
            settings.Add(new PHPIniSetting("session.save_path", value, "Session"));

            // Set cgi.force_redirect
            settings.Add(new PHPIniSetting("cgi.force_redirect", "0", "PHP"));
            
            // Set cgi.fix_pathinfo
            settings.Add(new PHPIniSetting("cgi.fix_pathinfo", "1", "PHP"));

            // Enable fastcgi impersonation
            settings.Add(new PHPIniSetting("fastcgi.impersonate", "1", "PHP"));
            
            // Disable fastcgi logging
            settings.Add(new PHPIniSetting("fastcgi.logging", "0", "PHP"));

            // Set maximum script execution time
            settings.Add(new PHPIniSetting("max_execution_time", "300", "PHP"));

            // Turn off display errors
            settings.Add(new PHPIniSetting("display_errors", "Off", "PHP"));
            file.AddOrUpdateSettings(settings);

            // Enable the most common PHP extensions
            List<PHPIniExtension> extensions = new List<PHPIniExtension>();
            extensions.Add(new PHPIniExtension("php_curl.dll", true));
            extensions.Add(new PHPIniExtension("php_gd2.dll", true));
            extensions.Add(new PHPIniExtension("php_gettext.dll", true));
            extensions.Add(new PHPIniExtension("php_mysql.dll", true));
            extensions.Add(new PHPIniExtension("php_mysqli.dll", true));
            extensions.Add(new PHPIniExtension("php_mbstring.dll", true));
            extensions.Add(new PHPIniExtension("php_openssl.dll", true));
            extensions.Add(new PHPIniExtension("php_soap.dll", true));
            extensions.Add(new PHPIniExtension("php_xmlrpc.dll", true));
            file.UpdateExtensions(extensions);

            file.Save(phpIniPath);
        }