The same server in Linux PhP2 version php5.3 and php5.4 coexistence of build notes

Source: Internet
Author: User
Tags fpm ini mkdir zend

Should be a brother to help the demand to operate this, brother Server, a need for zend+php 5.4, a website needs 5.3,

Before the brothers bought directly 2 servers, feeling too wasted money, so he set up, with the following build notes:

Basically shell, you try it, late at night, write a little messy, have questions,


php5.3 I don't care, a bunch of tutorials on the web, or the use of LNMP one-button installation package A variety of cool crooked,

Mainly say php5.3 and php5.4 coexistence of building notes, the source code is the site of the military brother stolen, haha


#!/bin/bash

echo [+] installing PHP 5.4 ... "
wget http://soft.vpser.net/web/php/php-5.4.41.tar.gz

Tar zxvf php-5.4.41.tar.gz php-5.4.41
CD php-5.4.41

./configure--prefix=/usr/local/php54--with-config-file-path=/usr/local/php54/etc--enable-fpm--with-fpm-user= www--with-fpm-group=www--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-iconv-dir-- With-freetype-dir=/usr/local/freetype--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr-- Enable-xml--disable-rpath--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl- -enable-mbregex--enable-mbstring--with-mcrypt--enable-ftp--with-gd--enable-gd-native-ttf-- With-mhash--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--with-gettext--disable-fileinfo


Make zend_extra_libs= '-liconv '
Make install

#ln-SF/USR/LOCAL/PHP54/BIN/PHP/USR/BIN/PHP54
#ln-sf/usr/local/php54/bin/phpize/usr/bin/phpize54
#ln-sf/usr/local/php54/bin/pear/usr/bin/pear54
#ln-sf/usr/local/php54/bin/pecl/usr/bin/pecl54
#if ["${stack}" = "Lnmp"]; Then
# LN-SF/USR/LOCAL/PHP54/SBIN/PHP-FPM/USR/BIN/PHP-FPM54
#fi

echo "Copy new PHP Configure File ..."
Mkdir-p/usr/local/php54/etc
CP Php.ini-production/usr/local/php54/etc/php.ini

# PHP Extensions
echo "Modify php.ini ..."
Sed-i ' s/post_max_size = 8m/post_max_size = 50m/g '/usr/local/php54/etc/php.ini
Sed-i ' s/upload_max_filesize = 2m/upload_max_filesize = 50m/g '/usr/local/php54/etc/php.ini
Sed-i ' s/;d ate.timezone =/date.timezone = prc/g '/usr/local/php54/etc/php.ini
Sed-i ' S/short_open_tag = Off/short_open_tag = On/g '/usr/local/php54/etc/php.ini
Sed-i ' s/; Cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g '/usr/local/php54/etc/php.ini
Sed-i ' s/; Cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g '/usr/local/php54/etc/php.ini
Sed-i ' s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g '/usr/local/php54/etc/php.ini
Sed-i ' s/max_execution_time = 30/max_execution_time = 300/g '/usr/local/php54/etc/php.ini
Sed-i ' s/disable_functions =.*/disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc _open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_ Socket_server/g '/usr/local/php54/etc/php.ini

#Pear_Pecl_Set??
#
Cd.. /

echo "Install Zendguardloader for PHP 5.4 ..."

wget http://soft.vpser.net/web/zend/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
Tar zxf zendguardloader-70429-php-5.4-linux-glibc23-x86_64.tar.gz
Mkdir-p/usr/local/zend54/
CP zendguardloader-70429-php-5.4-linux-glibc23-x86_64/php-5.4.x/zendguardloader.so/usr/local/zend54/


echo "Write Zendguardloader to PHP.ini ..."
Cat >>/usr/local/php54/etc/php.ini<<eof

; eaccelerator

; ioncube

[Zend Zendguard Loader]
Zend_extension=/usr/local/zend54/zendguardloader.so
Zend_loader.enable=1
Zend_loader.disable_licensing=0
Zend_loader.obfuscation_level_support=3
Zend_loader.license_path=

; XCache
; XCache End
Eof


echo "Creating new PHP-FPM Configure File ..."
Cat >/usr/local/php54/etc/php-fpm.conf<<eof
[Global]
PID =/usr/local/php54/var/run/php-fpm.pid
Error_log =/usr/local/php54/var/log/php-fpm.log
Log_level = Notice

[WWW]
Listen = 127.0.0.1:9009
Listen.backlog =-1
Listen.allowed_clients = 127.0.0.1
Listen.owner = www
Listen.group = www
Listen.mode = 0666
user = www
Group = www
PM = dynamic
Pm.max_children = 10
Pm.start_servers = 2
Pm.min_spare_servers = 1
Pm.max_spare_servers = 6
Request_terminate_timeout = 100
Request_slowlog_timeout = 0
Slowlog = Var/log/slow54.log
Eof

echo "Copy php-fpm init.d file ..."
CD php-5.4.41
CP Sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm54
chmod +x/etc/init.d/php-fpm54

# Note:/etc/init.d/php-fpm54 this to be changed: prefix=/usr/local/php change: PREFIX=/USR/LOCAL/PHP54
#重启下php-FPM
The port for the #顺便原来的php-FPM 5.3 is changed to listen = 127.0.0.1:9000
#nginx使用的时候, use the corresponding port:
# #fastcgi_pass Unix:/tmp/php-cgi.sock;
# Fastcgi_pass 127.0.0.1:9000; 5.3
# Fastcgi_pass 127.0.0.1:9009; 5.4
#
# Restart: 5.3/etc/init.d/php-fpm start
# Restart: 5.4/etc/init.d/php-fpm54 start


# # Finally give him the set up from the start bar. Update-rc.d-f php-fpm54 Defaults
#我这个是 Ubuntu ha ....
#

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.