centos7如何安装php-fpm
2022-12-02 09:01:16
294
{{single.collect_count}}

centos7安装“php-fpm”的方法:首先通过yum安装“php-fpm”相关组件;然后在“default.conf”中修改内容用以支持php;最后重启nginx服务即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

推荐:《centos入门教程

CentOS7用yum方式安装Nginx+php-fpm

环境

[root@localhost html]# cat /etc/centos-releaseCentOS Linux release 7.1.1503 (Core) [root@localhost sbin]# /usr/sbin/nginx -vnginx version: nginx/1.14.0[root@localhost /]# php-fpm -vPHP 5.4.16 (fpm-fcgi) (built: Apr 12 2018 19:03:25)Copyright (c) 1997-2013 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
登录后复制

1.安装nginx

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmyum install -y nginxsystemctl start nginxsystemctl status nginxsystemctl stop nginxsystemctl enable nginx
登录后复制

用浏览器打开以下地址能访问就说明配置成功了

http://192.168.0.61/
登录后复制

2.yum安装php-fpm相关组件

yum -y install php php-fpm php-gd php-mysql php-common php-pear php-mbstring php-mcryptsystemctl status php-fpmsystemctl start php-fpmsystemctl enable php-fpm
登录后复制

3.编辑/etc/nginx/conf.d/default.conf并添加以下内容以支持php

vim /etc/nginx/conf.d/default.conf

#location ~ \.php$ {root /usr/share/nginx/html;fastcgi_pass 127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;includefastcgi_params;}
登录后复制

修改完配置以后需要重启nginx服务

4.建立index.php文件并测试

vim /usr/share/nginx/html/index.php

<?phpphpinfo();?>
登录后复制

打开:http://192.168.0.61

以上就是centos7如何安装php-fpm的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}