欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux系統(tǒng)下多版本php共存的解決方案(超簡(jiǎn)單)

 更新時(shí)間:2018年10月09日 17:00:00   作者:紅塵碼農(nóng)  
如何在Linux系統(tǒng)下使多版本php共存,今天為大家介紹一種簡(jiǎn)單方案

自php7問世,身為最新版本控的我馬上升級(jí)體驗(yàn),但是由于服務(wù)器上還有舊程序在運(yùn)行,只好部署一個(gè)php多版本共存環(huán)境。

現(xiàn)有環(huán)境是lnmp
- CentOS 6.7
- nginx 1.10.1
- mariadb-10.0.26
- php 7.0.8

為了更好兼容舊的php程序,推薦使用5.4.45. 主要是兼容mysql擴(kuò)展。

開始安裝

首先要下載php-5.4.45.tar.gz源碼包。

通過源碼安裝

# tar xzvf php-5.4.45.tar.gz
# cd php-5.4.45

# ./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-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-intl --with-xsl

# make ZEND_EXTRA_LIBS='-liconv'
# make install
# cp php.ini-production /usr/local/php/etc/php.ini

php.ini 配置

post_max_size = 50M
upload_max_filesize = 50M
date.timezone = PRC
short_open_tag = On
cgi.fix_pathinfo=0
max_execution_time = 300
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

php-fpm.conf 配置

# vim /usr/local/php/etc/php-fpm.conf
[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 = /tmp/php54-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1:9001
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 40
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 40
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log

注意:重點(diǎn)是配置監(jiān)聽端口和進(jìn)程

啟動(dòng) php-fpm

# cp sapi/fpm/init.d.php-fpm /etc/init.d/php54-fpm
# chmod +x /etc/init.d/php54-fpm
# /etc/init.d/php54-fpm start

修改nginx配置,對(duì)需要的服務(wù)配置使用php-5.4.45

location ~ [^/]\.php(/|$)
 {
  try_files $uri =404;
  fastcgi_pass unix:/tmp/php54-cgi.sock;
  fastcgi_index index.php;
  include fastcgi.conf;
 }

配置php-5.4.45 的php54-fpm 開機(jī)自動(dòng)啟動(dòng)

# chkconfig --add php54-fpm
# chkconfig php54-fpm on

chkconfig 功能說明:檢查,設(shè)置系統(tǒng)的各種服務(wù)。
語法:chkconfig [–add][–del][–list][系統(tǒng)服務(wù)]
chkconfig [–level <等級(jí)代號(hào)>][系統(tǒng)服務(wù)][on/off/reset]

本方案的重點(diǎn)是

每個(gè)PHP版本都要安裝在新的獨(dú)立的文件夾里

每個(gè)PHP版本的php-fpm.conf配置文件都需要設(shè)置不同的進(jìn)程名和監(jiān)聽端口

nginx配置文件中指定要使用的PHP版本監(jiān)聽端口或進(jìn)程名

相關(guān)文章

  • centos6.5安裝vncserver圖文教程

    centos6.5安裝vncserver圖文教程

    這篇文章主要介紹了centos6.5安裝vncserver圖文教程的相關(guān)資料,這里對(duì)centos 安裝vncserver 進(jìn)行了實(shí)例介紹,需要的朋友可以參考下
    2016-11-11
  • Linux入門之網(wǎng)絡(luò)系統(tǒng)詳解

    Linux入門之網(wǎng)絡(luò)系統(tǒng)詳解

    大家好,本篇文章主要講的是Linux入門之網(wǎng)絡(luò)系統(tǒng)詳解,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • 在Linux配置自啟動(dòng)jar包方式

    在Linux配置自啟動(dòng)jar包方式

    這篇文章主要介紹了在Linux配置自啟動(dòng)jar包方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • linux啟動(dòng)和重啟nginx方法

    linux啟動(dòng)和重啟nginx方法

    在本篇文章里小編給大家整理了關(guān)于linux如何啟動(dòng)nginx并重啟哦的小技巧,有需要的朋友們參考下。
    2019-06-06
  • 關(guān)于Read-only file system問題的解決

    關(guān)于Read-only file system問題的解決

    這篇文章主要介紹了關(guān)于Read-only file system問題的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • Linux命令學(xué)習(xí)總結(jié):詳解shutdown命令

    Linux命令學(xué)習(xí)總結(jié):詳解shutdown命令

    本篇文章主要介紹了Linux命令學(xué)習(xí)總結(jié):詳解shutdown命令,該命令可以安全關(guān)閉或者重新啟動(dòng)系統(tǒng)。有興趣的可以了解一下。
    2016-12-12
  • CentOS下Lighttpd Web服務(wù)器安裝與配置方法

    CentOS下Lighttpd Web服務(wù)器安裝與配置方法

    CentOS下Lighttpd Web服務(wù)器安裝與配置方法,需要的朋友可以參考下。
    2011-04-04
  • linux curl命令詳解及實(shí)例分享

    linux curl命令詳解及實(shí)例分享

    curl命令使用了libcurl庫來實(shí)現(xiàn),libcurl庫常用在C程序中用來處理HTTP請(qǐng)求,curlpp是libcurl的一個(gè)C++封裝,這幾個(gè)東西可以用在抓取網(wǎng)頁、網(wǎng)絡(luò)監(jiān)控等方面的開發(fā),而curl命令可以幫助來解決開發(fā)過程中遇到的問題。
    2014-08-08
  • Linux之如何設(shè)置CPU Performance模式

    Linux之如何設(shè)置CPU Performance模式

    這篇文章主要介紹了Linux之如何設(shè)置CPU Performance模式問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • Linux如何定時(shí)清空日志內(nèi)容和刪除日志文件

    Linux如何定時(shí)清空日志內(nèi)容和刪除日志文件

    這篇文章主要介紹了Linux如何定時(shí)清空日志內(nèi)容和刪除日志文件,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12

最新評(píng)論