【PHP】安裝
author:咔咔
wechat:fangkangfk
這個基本沒有什麼問題,直接按照流程操作即可
環境:CentOS 7.4.1708
一、檢查當前系統是否已經安裝PHP
1 |
|
二、檢視yum是否有可安裝的PHP軟體
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
base
|
三、安裝PHP
1 |
|
四、檢視版本及支援的擴充套件
1 2 3 4 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
五、安裝php-mysqlnd
當前系統已安裝的mysql版本是:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
安裝php-mysqld外掛
1 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
要讓PHP以FastCGI的方式與nginx進行互動,需要有PHP-FPM模組的支援。
安裝PHP-FPM
1 |
|
1 2 3 4 |
|
啟動PHP-FPM
1 |
|
以上安裝完成後,接下來,配置Nginx支援PHP(FastCGI方式)。
修改 /usr/local/nginx/conf/nginx.conf 把如下圖紅色框中的#去掉就可以了。
這裡面都是預設的,root是配置php程式放置的根目錄。
還需要修改的就是fastcgi_param中的/scripts為$document_root
修改完成後,讓nginx重新載入配置以生效:
1 |
|
測試
1 2 3 4 5 6 7 |
|