强烈向大家推荐一个好网站,【我要自学网】,教程由在校老师录制,有办公会计、平面设计、室内设计、机械设计、网页编程、影视动画等教程.....让你足不出门,都可以体验学校的专业教育!
安装不同版本php
wdcp默认只能支持一个php版本,但是使用nginx就可以进行多php版本并存。下面是默认5.2并存5.3
wdcp2.0预装环境,并行php执行脚本
php5.3的脚本代码
#!/bin/bash ###yum yum install -y libmcrypt-devel libjpeg-devel libpng-devel freetype-devel curl-devel openssl-devel libxml2-devel gmp-devel ### if [ ! -f php-5.3.29.tar.gz ];then wget -c http://dl.wdlinux.cn:5180/soft/php-5.3.29.tar.gz fi if [ ! -f iconv_ins.sh ];then wget -c http://down.wdlinux.cn/in/iconv_ins.sh sh iconv_ins.sh fi ### tar zxvf php-5.3.29.tar.gz cd php-5.3.29 if [ -d /www/wdlinux/nginx_php ];then make clean ./configure --prefix=/www/wdlinux/nginx_php-5.3.29 --with-config-file-path=/www/wdlinux/nginx_php-5.3.29/etc --with-mysql=/www/wdlinux/mysql -with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --with-gmp --enable-ftp --enable-sockets --enable-zip --enable-fpm [ $? != 0 ] && echo "configure err" && exit make [ $? != 0 ] && echo "make err" && exit make install [ $? != 0 ] && echo "make install err" && exit cp php.ini-production /www/wdlinux/nginx_php-5.3.29/etc/php.ini #grep '\[eaccelerator\]' -A15 /www/wdlinux/nginx_php/etc/php.ini >> /www/wdlinux/nginx_php-5.3.29/etc/php.ini #grep '\[Zend\]' -A5 /www/wdlinux/nginx_php/etc/php.ini >> /www/wdlinux/nginx_php-5.3.29/etc/php.ini sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-5.3.29/etc/php.ini service php-fpm stop rm -f /www/wdlinux/nginx_php ln -sf /www/wdlinux/nginx_php-5.3.29 /www/wdlinux/nginx_php cp /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf.default /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf sed -i 's/127.0.0.1::9000/127.0.0.1::9003/g' /www/wdlinux/nginx_php-5.3.29/etc/php-fpm.conf cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php53 chmod 755 /www/wdlinux/init.d/php-fpm service php53 start echo echo "php update is OK" fi echo
php5.3 php-fpm端口9003 下载链接:5.3脚本 下载地址:http://www.gotoip.top/download/php_up53.sh
命令 5.3:sh php_up53.sh
php5.4 5.5 5.6的脚本代码
#!/bin/bash # PHP 5.4 update scripts # Author: wdlinux # Url: http://www.wdlinux.cn # Modify: fengye if [ ! $1 ];then Ver=5.4.26 X=4 else if [ $1 = 5.5.32 ];then Ver=$1 X=5 else Ver=$1 X=6 fi fi ###yum yum clean all yum install -y gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel patch libmcrypt-devel libmhash-devel ncurses-devel bzip2-devel libcap-devel gmp-devel t1lib-devel libc-client-devel sqlite-devel aspell-devel readline-devel recode-devel libtidy-devel libxslt-devel openldap-devel ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so ### if [ ! -f php-${Ver}.tar.gz ];then wget -c http://cn2.php.net/distributions/php-${Ver}.tar.gz fi if [ ! -f iconv_ins.sh ];then wget -c http://down.wdlinux.cn/in/iconv_ins.sh sh iconv_ins.sh fi ### if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.18 ];then if [ -d /usr/lib64 ];then LIBNCU="/usr/lib64" else LIBNCU="/usr/lib" fi ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.18 $LIBNCU fi tar zxvf php-${Ver}.tar.gz cd php-${Ver} if [ -d /www/wdlinux/nginx_php ];then make clean ./configure --prefix=/www/wdlinux/nginx_php-${Ver} --with-config-file-path=/www/wdlinux/nginx_php-${Ver}/etc --with-mysql=/www/wdlinux/mysql --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-soap --with-imap --with-kerberos --with-imap-ssl --enable-ftp --enable-sockets --enable-zip --enable-fpm --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql --with-gmp --enable-bcmath [ $? != 0 ] && echo "configure err" && exit make [ $? != 0 ] && echo "make err" && exit make install [ $? != 0 ] && echo "make install err" && exit cp php.ini-production /www/wdlinux/nginx_php-${Ver}/etc/php.ini sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-${Ver}/etc/php.ini service php-fpm stop #rm -f /www/wdlinux/nginx_php #ln -sf /www/wdlinux/nginx_php-${Ver} /www/wdlinux/nginx_php cp /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf.default /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf sed -i "s/127.0.0.1:9000/127.0.0.1:900${X}/g" /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php-${Ver} chmod 755 /www/wdlinux/init.d/php-${Ver} ln -s /www/wdlinux/init.d/php-${Ver} /etc/init.d/ if [ ! -d /www/wdlinux/nginx_php-${Ver}/lib/php/extensions ];then mkdir -p /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20100525 ln -sf /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20100525 /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-non-zts-20100525 fi service php-${Ver} start echo echo "php-${Ver} update is OK" fi echo
php5.4,5.5,5.6 php-fpm端口9004 9005 9006 下载链接:5.3脚本 下载地址:http://www.gotoip.top/download/php_up54.sh
命令:5.4:sh php_up54.sh
5.5:sh php_up54.sh 5.5.32
5.6:sh php_up54.sh 5.6.18
设置站点不同php
在wdcp网站后台,设置web引擎为nginx
在到需要使用该php版本的站点,网站管理-站点列表-文管
点击nginx站点配置
找到站点对应站点的配置文件*.conf,进入编辑
修改php-fpm的监听端口,之前5.3脚本使用的是9003,,将原来php5.2的9000端口修改为9003,保存。
在到系统管理-服务重启中重启web附图。