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 |
|
三、安装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 |
|