yum install yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
============================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================
Installing:
remi-release noarch 7.8-1.el7.remi /remi-release-7 28 k
Installing for dependencies:
epel-release noarch 7-13 epel 15 k
Transaction Summary
============================================================================================================================================================================================================
[root@192-168-31-103 ~]# yum repoinfo | grep Repo-filename
Repo-filename: /etc/yum.repos.d/base.repo
Repo-filename: /etc/yum.repos.d/epel.repo
Repo-filename: /etc/yum.repos.d/base.repo
Repo-filename: /etc/yum.repos.d/remi-safe.repo
Repo-filename: /etc/yum.repos.d/base.repo
rpm -ql remi-release
[root@192-168-31-103 /etc/yum.repos.d]# ls
base.repo epel.repo.rpmnew remi-glpi91.repo remi-glpi93.repo remi-modular.repo remi-php70.repo remi-php72.repo remi-php74.repo remi.repo
epel.repo epel-testing.repo remi-glpi92.repo remi-glpi94.repo remi-php54.repo remi-php71.repo remi-php73.repo remi-php80.repo remi-safe.repo
cat /etc/yum.repos.d/remi-php74.repo
yum-config-manager --enable remi-php74
cat /etc/yum.repos.d/remi-php74.repo
yum install php php-common php-opcache php-pecl-mcrypt php-cli \
php-gd php-curl php-mysqlnd php-devel php-embedded \
php-mbstring php-pdo php-xml php-fpm php-pecl-memcached \
php-pecl-redis5 php-pecl-mongodb
https://gitee.com/as4k/xdocs/blob/master/xfile/yum_install_php74.txt
[root@192-168-31-103 ~]# php -v
PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
/etc/php-fpm.d/www.conf
...
user = nginx
...
group = nginx
...
listen = /run/php-fpm/www.sock
...
listen.owner = nginx
listen.group = nginx
systemctl status php-fpm
chown -R root:nginx /var/lib/php
参考nginx conf
=============
server {
# . . . other code
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
参考资料
https://linuxize.com/post/install-php-7-on-centos-7/
https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/php74/x86_64/