linux版本:64位元centos 6.4
nginx版本:nginx1.8.0
php版本:php5.5.28 & php5.4.44
#注意假如php5.5是主版本已經安裝在/usr/local/php目錄下,那麼再安裝其他版本的php再指定不同安裝目錄即可。
安裝php
# wget http://cn2.php.net/get/php-5.4.44.tar.gz/from/this/mirror # tar zxvf php-5.4.44.tar.gz # cd php-5.4.44 #./configure --prefix=/usr/local/php5.4.44 \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysql \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip # make && make install # cp -r ./sapi/fpm/php-fpm.conf /usr/local/php5.4.44/etc/php-fpm.conf # cp php.ini-development /usr/local/php5.4.44/lib/php.ini # cp -r ./sapi/fpm/php-fpm /etc/init.d/php-fpm5.4.44
修改php-fpm.conf的偵聽埠為9001,因為主版本5.5.28是偵聽9000。
; note: this value is mandatory. listen = 127.0.0.1:9001
啟動php-fpm
# /etc/init.d/php-fpm5.4.44
php安裝成功查看進程
#ps aux|grep php
這樣就已經起好php-fpm了。
設定nginx
增加一段新的連接埠8054的設定並指向到9001以及指定目錄即可:
server { listen 8054; server_name localhost; location / { #root html; root /usr/www5.4.44; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; include fastcgi_params; fastcgi_param script_filename /usr/www5.4.44$fastcgi_script_name; } }
nginx的設定檔nginx .conf在
# cd /usr/local/nginx/conf
完整的nginx配置如下:
#user nobody; worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #root html; root /usr/www; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param script_filename /usr/www$fastcgi_script_name; } # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } server { listen 8054; server_name localhost; location / { #root html; root /usr/www5.4.44; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; include fastcgi_params; fastcgi_param script_filename /usr/www5.4.44$fastcgi_script_name; } } # another virtual host using mix of ip-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # https server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:ssl:1m; # ssl_session_timeout 5m; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
重啟nginx
# /usr/local/nginx/sbin/nginx -s reload
注意需要防火牆增加新連接埠的開啟,不然無法存取:
防火牆設定
注意如果你希望在本機例如xp存取虛擬機器的網頁,如果是centos6需要修改防火牆啟動80埠
# cd /etc/sysconfig
修改iptables文件,或直接用vim編輯
# vim /etc/sysconfig/iptables
新增下面一行,開啟防火牆80埠:
-a input -m state --state new -m tcp -p tcp --dport 8054 -j accept
重啟防火牆
# /etc/init.d/iptables restart
測試是否成功,檢視phpinfo( )
以上是Linux系統下如何為Nginx安裝多版本PHP的詳細內容。更多資訊請關注PHP中文網其他相關文章!

新年伊始,雷軍抖音跨年直播分享了2025年的三個新年願望,這場長達四個半小時的直播吸引了眾多關注。雷軍的三大願望分別是:第一,實現30萬輛汽車交付目標,緩解壓力,不再被進度追趕。第二,擁有更多旅行時間,欣賞各地美景、品嚐特色美食,並結合工作進行汽車測試。第三,堅持健身,計劃在健身房打卡100次,強身健體。雷軍在直播中坦言,2024年奔波於各地,行程安排緊湊,往往只能短暫停留,難以深入體驗當地文化。例如,在德國紐北賽道,他僅停留了8個小時。因此,在新的一年裡,他希望能夠更好地平衡工作與生活,在旅行

九號公司攜手品牌代言人易烊千璽打造的微電影《記憶奇旅》,在2024年榮獲多項權威媒體大獎,成為年度口碑佳作。這部作品以獨特的敘事風格、精湛的製作和真摯的情感,贏得了業界的高度讚譽。 2024年度獲獎榮譽:2024金觸點全球商業創新大獎-年度影視廣告2024中國廣告營銷大獎-娛樂營銷組銀獎2024TopDigital創新營銷獎-影視製作類金獎2024上海國際廣告節-微電影銀獎2024第十一屆中國創新傳播大獎-整合營銷類銀獎WISE2024商業之王-年度案例第31屆中國國際廣告節2024數字營銷實戰大

近日,PConline2024智臻科技獎正式揭曉,AGON愛攻QD-OLED電競顯示器AG326UD榮獲“年度技術創新”獎項。此項殊榮不僅代表了業界對其技術優勢與市場表現的高度認可,更充分體現了AGON愛攻在電競顯示器技術領域的創新能力和卓越成就。 01.瞰科技未來,品技術革命PConline智臻科技獎的權威含金量作為科技行業的風向標,PConline智臻科技獎憑藉其嚴謹的評審體系和深度的行業分析,成功贏得廣泛的行業認可。該獎項始終致力於表彰推動科技行業發展的優秀產品和品牌,涵蓋從技

SonyInteractiveEntertainment(SIE,索尼互动娱乐)首席架构师MarkCerny公开更多次世代主机PlayStation5Pro(PS5Pro)硬体细节,包括性能升级的AMDRDNA2.x架构GPU,以及与AMD合作代号「Amethyst」的机器学习/人工智慧计划。PS5Pro性能提升的重点仍集中在更强大的GPU、先进的光线追踪与AI驱动的PSSR超解析度功能等3大支柱上。GPU採用客制化的AMDRDNA2架构,索尼将其命名为RDNA2.x,它拥有部分RDNA3架构才

微軟針對Windows搜索功能的改進,目前已在歐盟地區部分WindowsInsider頻道展開測試。此前,整合後的Windows搜索功能飽受用戶詬病,體驗欠佳。此次更新將搜索功能拆分為本地搜索和基於Bing的網絡搜索兩部分,以提升用戶體驗。新版搜索界面默認進行本地文件搜索,如需進行網絡搜索,需點擊“MicrosoftBingWebSearch”標籤進行切換。切換後,搜索欄將顯示“MicrosoftBingWebSearch:”,用戶可在此輸入關鍵詞。此舉有效避免了本地搜索結果與Bing搜索結果混

為慶祝卡普空《怪物獵人》系列20週年,寶島社推出了一款別具匠心的雜誌套裝——《怪物獵人》主題燒烤計時器及隨行杯。該套裝將於12月27日在日本全國全家便利店發售,售價3498日元。這款雜誌套裝最大的亮點在於其互動式燒烤計時器,完美復刻了系列遊戲中的經典燒烤場景。計時器採用舊版烤肉工具的設計,配有LED火焰燈效和遊戲BGM,讓您在實際燒烤過程中也能體驗到狩獵的樂趣。旋轉手柄模擬翻轉烤肉,成功烤熟後更會播放“烤好了!”的語音提示。計時器尺寸約為9.5cm(高)x10.7cm(寬)x8cm(深),內置L

小米汽車一周年慶典,為車主送上新年大禮!繼去年交付量突破13萬輛後,小米汽車官方微博宣布,將為每位小米SU7車主及準車主贈送雷軍經典語錄“AreyouOK?”主題氣門芯帽,數量有限,免費領取!活動時間:2024年12月28日下午4點至2025年1月20日23:59:59。在2024年12月31日23:59:59前購車或完成訂單的用戶,即可免費獲得一套四件套“AreyouOK?”氣門芯帽。這款氣門芯帽於今年9月首發,採用亮黃色PVC和黃銅材質製成,黃銅芯直接嵌入,確保行駛安全,不易脫落。用途廣泛,

據報導,HDMI2.2標準有望在2025年CES展會前夕正式發布,HDMIForum計劃於1月6日公佈這一新一代視頻信號傳輸協議規範。 2017年發布的HDMI2.1標準,最大帶寬為48Gbps,支持4K144Hz和8K30Hz視頻傳輸,結合DSC技術最高可達10K120Hz。預計HDMI2.2將大幅提升帶寬,支持更高分辨率和刷新率,並採用新型線材。雖然具體規格尚未公開,但HDMI2.2勢必超越HDMI2.1的48Gbps帶寬和10240*4320分辨率限制。鑑於DisplayPort2.1在20


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

禪工作室 13.0.1
強大的PHP整合開發環境

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器