yum安装php7.3

1 安装php

yum install epel-release
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm  
yum install yum-utils
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll

2 开机启动

systemctl daemon-reload
systemctl enable php73-php-fpm
systemctl start php73-php-fpm

3 查找安装包

rpm -qa | grep 'php'

4 找到安装位置

rpm -ql php73-php-fpm-7.3.6-1.el7.remi.x86_64

5 查找php.ini位置

find /etc/opt/remi/php73 -name php.ini

6 编辑/etc/opt/remi/php73/php.ini替换换 ;cgi.fix_pathinfo=1 为 cgi.fix_pathinfo=0 快捷命令:

sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/opt/remi/php73/php.ini

7 操作

systemctl restart php73-php-fpm #重启
systemctl start php73-php-fpm #启动
systemctl stop php73-php-fpm #关闭
systemctl status php73-php-fpm #检查状态

查看 PHP
php73 -v
更新 PHP
yum update
删除
yum remove php*

8 测试

echo ''  >  /var/www/html/index.php

9 修改fastcgi连接方式

vim /etc/opt/remi/php73/php-fpm.conf

vim /etc/opt/remi/php73/php-fpm.d/www.conf

listen = 127.0.0.1:9000 #默认

#可以修改为listen = /dev/shm/php-cgi.sock 

修改nginx配置文件server段的配置,将http的方式改为socket方式

location ~ .*\.(php|php5)?$  {
                #fastcgi_pass  127.0.0.1:9000;
                fastcgi_pass   unix:/dev/shm/php-cgi.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
        }

你可能感兴趣的:(网站服务)