美文网首页
Linux下安装php

Linux下安装php

作者: 行将醒来的意识 | 来源:发表于2018-07-13 15:48 被阅读24次
  • rpm 安装 Php7 相应的 yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

  • 安装php7.0

yum install -y php70w

  • 安装php扩展

yum install -y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64

  • 安装PHP FPM

yum install -y php70w-fpm

修改php-fpm配置文件

  • php-fpm配置文件位置:(/etc/php-fpm.d/www.conf
    ​ * 修改

user =nginx
​ group=nginx

在nginx.conf配置php

//在 location / { }下面增加
location ~ \.php$ {
                        root /usr/share/nginx/html; #指定php的根目录
                        fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }

启动nginx服务

  • 启动nginx服务

systemctl start nginx.service

  • 查看启动状态

systemctl status nginx
看到以下字眼说明启动成功!
​Active: active (running) since 六 2016-11-19 13:40:04 CST; 50min ago

相关文章

网友评论

      本文标题:Linux下安装php

      本文链接:https://www.haomeiwen.com/subject/tstspftx.html