有这个需求是测试服务器要上一套老的ecshop;
于是版本不能太高;
方案:
通过nginx把请求传递给不同版本的cgi处理;然而遇到了一些麻烦;编译安装的时候根本就走不通。(现在走通了,但是我觉得肯定还存在问题,就是说扩展是有作用范围的。通过yum install 的扩展支持,是不是全局的?全局的肯定影响性能)
step 1:下载源码包
sep 2:准备编译的参数
参考:
./configure --prefix=/usr/local/php.5.3 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql=/usr/local/mysql--with-pdo-mysql --with-mysqli --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=nginx --with-fpm-group=nginx --with-libdir=lib64 --enable-ftp --with-jpeg-dir=/usr/lib/ --enable-fpm
然后make && make install
step 3 复制ini文件到指定目录下;
Installing PHP SAPI module: cgi
Installing PHP CGI binary: /usr/local/php.5.3/bin/
Installing PHP CLI binary: /usr/local/php.5.3/bin/
Installing PHP CLI man page: /usr/local/php.5.3/man/man1/
Installing build environment: /usr/local/php.5.3/lib/php/build/
Installing header files: /usr/local/php.5.3/include/php/
Installing helper programs: /usr/local/php.5.3/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php.5.3/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php.5.3/lib/php/
[PEAR] Archive_Tar - installed: 1.3.12
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.3
[PEAR] PEAR - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php.5.3/etc/pear.conf
You may want to add: /usr/local/php.5.3/lib/php to your php.ini include_path
/usr/local/php5.2.5/php-5.3.29/build/shtool install -c ext/phar/phar.phar /usr/local/php.5.3/bin
ln -s -f /usr/local/php.5.3/bin/phar.phar /usr/local/php.5.3/bin/phar
Installing PDO headers: /usr/local/php.5.3/include/php/ext/pdo/
step 4 启动一个cgi 进程
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9001 -C 5 -f /usr/local/php.5.3/bin/php-cgi(这里定了9001端口,当然你也可以通过修改config文件 指定端口)
step 5 前提你有spawn-fcgi 没有的话编译安装;
step 6 配置nginx 虚拟机 fastcgi_pass 127.0.0.1:9001;端口请注意