centos系统下使用yum安装php7.4正式版,当前基于WLNMP提供的一键安装包来安装
1、添加epel源
yum install epel-release
|---|--------------------------| | 1 | yum install epel-release |
2、添加WLNMP一键安装包源
rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
|---|--------------------------------------------------------------------------| | 1 | rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm |
3、安装php7.4
yum clean all yum install wphp74
|-----|----------------------------------| | 1 2 | yum clean all yum install wphp74 |
启动方式
/etc/init.d/php-fpm74 restart
|---|-------------------------------| | 1 | /etc/init.d/php-fpm74 restart |
4、配置nginx
(1)如果使用WLNMP提供的nginx,只需要在nginx安装后取消include enable-php71.conf;取消注释即可
WLNMP安装nginx方法
yum install wnginx
|---|--------------------| | 1 | yum install wnginx |
(2)如果当前使用的是非WLNMP提供的nginx,只需要在nginx中配置以下内容即可
location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-fpm74.sock; fastcgi_index index.php; include fastcgi.conf; }
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 | location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-fpm74.sock; fastcgi_index index.php; include fastcgi.conf; } |
更多相关内容可参考:https://www.wlnmp.com/