centos8 安装php7.4

安装php-fpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf module install php:7.4
 
配置php-fpm服务
# vim /etc/php-fpm.d/www.conf user = nginx # 这个值原来是apache group = nginx # 这个值原来是apache
记得在编辑的时候记录一下listen的值,一会配置nginx的时候要用到
listen = /run/php-fpm/www.sock
 
启动php-fpm服务
# systemctl enable php-fpm # systemctl start php-fpm
 
配置nginx
 
# vim /etc/nginx/conf.d/default.conf
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.html index.htm;
        if (!-e $request_filename) {
            rewrite  ^(.*)$  /index.php?s=/$1  last;
            break;
        }
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        root           /var/www/html;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

 

启动nginx服务
systemctl enable nginx systemctl start nginx
 
centos中gd库开启
yum -y install php-gd
systemctl restart nginx
 
yum install php-pdo_mysql
sudo service php-fpm restart

posted on 2020-12-19 13:35  小帅豹  阅读(1151)  评论(0编辑  收藏  举报