环境:
centos 6 x86_64
apache 2.2.X
安装了5.2 后再安装5.3 5.4
发现无法切换PHP版本。
检查代码段:
function SetPHPVersion(){
$siteName = I('siteName');
$version = I('version');
if($_SESSION['server_type'] == 'nginx'){
$file = '/www/server/nginx/conf/vhost/'.$siteName.'.conf';
$conf = file_get_contents($file);
$rep = "/enable-php-([0-9]{2,3})\.conf/";
preg_match($rep,$conf,$tmp);
$conf = str_replace($tmp[0],'enable-php-'.$version.'.conf',$conf);
}else{
$file = '/www/server/apache/conf/vhost/'.$siteName.'.conf';
$conf = file_get_contents($file);
$rep = "/php-cgi-([0-9]{2,3})\.sock/";
preg_match($rep,$conf,$tmp);
$conf = str_replace($tmp[0],'php-cgi-'.$version.'.sock',$conf);
}
if (file_put_contents('/tmp/read.tmp', $conf)) {
$result = SendSocket("FileAdmin|SaveFile|" . $file);
serviceWebReload();
if($result['status']) WriteLogs("网站管理", "将网站[$siteName]PHP版本切换为[$version]!");
ajax_return($result);
}
ajax_return(array('status' => false, 'msg' => '保存失败!'));
}
发现只对 fpm 模式做了处理。此模式不适用于 php_mod 。。。
|
|