Esempio n. 1
0
function switchPhpVersion($newPhpVersion)
{
    require 'config.inc.php';
    //on charge le fichier de conf de la nouvelle version
    require $c_phpVersionDir . '/php' . $newPhpVersion . '/' . $wampBinConfFiles;
    //on determine les textes httpd.conf en fonction de la version d'apache
    $apacheVersion = $wampConf['apacheVersion'];
    while (!isset($phpConf['apache'][$apacheVersion]) && $apacheVersion != '') {
        $pos = strrpos($apacheVersion, '.');
        $apacheVersion = substr($apacheVersion, 0, $pos);
    }
    // on modifie le fichier de conf d'apache
    $httpdContents = file($c_apacheConfFile);
    $newHttpdContents = '';
    foreach ($httpdContents as $line) {
        if (strstr($line, 'LoadModule') && strstr($line, 'php')) {
            $newHttpdContents .= 'LoadModule ' . $phpConf['apache'][$apacheVersion]['LoadModuleName'] . ' "' . $c_phpVersionDir . '/php' . $newPhpVersion . '/' . $phpConf['apache'][$apacheVersion]['LoadModuleFile'] . '"' . "\r\n";
        } elseif (!empty($phpConf['apache'][$apacheVersion]['AddModule']) && strstr($line, 'AddModule') && strstr($line, 'php')) {
            $newHttpdContents .= 'AddModule ' . $phpConf['apache'][$apacheVersion]['AddModule'] . "\r\n";
        } else {
            $newHttpdContents .= $line;
        }
    }
    file_put_contents($c_apacheConfFile, $newHttpdContents);
    //on modifie la conf de wampserver
    $wampIniNewContents['phpIniDir'] = $phpConf['phpIniDir'];
    $wampIniNewContents['phpExeDir'] = $phpConf['phpExeDir'];
    $wampIniNewContents['phpConfFile'] = $phpConf['phpConfFile'];
    // Renseigne ancienne version PHP
    $wampIniNewContents['phpLastKnown'] = $wampConf['phpVersion'];
    $wampIniNewContents['phpVersion'] = $newPhpVersion;
    wampIniSet($configurationFile, $wampIniNewContents);
    //Create symbolic link to php dll's and to phpForApache.ini of new version
    linkPhpDllToApacheBin($newPhpVersion);
}
Esempio n. 2
0
Action: service; Service: ' . $c_apacheService . '; ServiceAction: stop; Flags: waituntilterminated
Action: run; FileName: "' . $c_phpCli . '";Parameters: "switchWampParam.php ' . $wampConfParams[$paramname] . ' on";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
Action: run; FileName: "' . $c_phpCli . '";Parameters: "refresh.php";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start ' . $c_apacheService . '"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
';
        } elseif ($params_for_wampconf[$paramname] == -1) {
            $wampConfText .= '[' . $wampConfParams[$paramname] . ']
Action: service; Service: ' . $c_apacheService . '; ServiceAction: stop; Flags: waituntilterminated
Action: run; FileName: "' . $c_phpCli . '";Parameters: "switchWampParam.php ' . $wampConfParams[$paramname] . ' create off [options]";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
Action: run; FileName: "' . $c_phpCli . '";Parameters: "refresh.php";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start ' . $c_apacheService . '"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
';
        }
    }
    $tpl = str_replace(';WAMPSETTINGSSTART', $wampConfText, $tpl);
}
// ************************
//on enregistre le fichier wampmanager.ini
$fp = fopen($wampserverIniFile, 'w');
fwrite($fp, $tpl);
fclose($fp);
//Check alias and paths in httpd-autoindex.conf
check_autoindex();
//Checking symbolic links from Apache/bin
//  on the dll files and phpForApache.ini in the active version of php
linkPhpDllToApacheBin($wampConf['phpVersion']);