系统相关
首页 > 系统相关> > centos7 yum安装php7.3.16

centos7 yum安装php7.3.16

作者:互联网

2.CentOS 7 yum 安装 PHP7.3.16

 

 

1、首先安装 EPEL 源:

1 yum install epel-release

安装 REMI 源:

1 yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

2、安装 Yum 源管理工具:

1 yum install yum-utils

3、安装 PHP7.3:

1 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

安装完成后最好重启一下计算机,不然有可能无法启动php(启动不了的时候再重启 ,暂时可不重启)
设置开机启动、运行服务:

1 systemctl enable php73-php-fpm
2 systemctl start php73-php-fpm

设置 PHP
查找安装包:

 1 [root@xxx etc]# rpm -qa | grep 'php'
 2 
 3 php73-php-cli-7.3.6-1.el7.remi.x86_64
 4 php73-php-mbstring-7.3.6-1.el7.remi.x86_64
 5 php73-php-pecl-mcrypt-1.0.2-1.el7.remi.x86_64
 6 php73-runtime-2.0-1.el7.remi.x86_64
 7 php73-php-pdo-7.3.6-1.el7.remi.x86_64
 8 php73-php-bcmath-7.3.6-1.el7.remi.x86_64
 9 php73-php-fpm-7.3.6-1.el7.remi.x86_64
10 php73-php-mysqlnd-7.3.6-1.el7.remi.x86_64
11 php73-php-snmp-7.3.6-1.el7.remi.x86_64
12 php73-php-gd-7.3.6-1.el7.remi.x86_64
13 php73-php-json-7.3.6-1.el7.remi.x86_64
14 php73-php-soap-7.3.6-1.el7.remi.x86_64
15 php73-php-recode-7.3.6-1.el7.remi.x86_64
16 php73-php-pecl-crypto-0.3.1-5.el7.remi.x86_64
17 php73-php-common-7.3.6-1.el7.remi.x86_64
18 php73-php-opcache-7.3.6-1.el7.remi.x86_64
19 php73-php-pecl-geoip-1.1.1-6.el7.remi.x86_64

找到:php73-php-fpm-7.3.6-1.el7.remi.x86_64安装位置

(我的版本是7.3.16)

 1 [root@xxx etc]# rpm -ql php73-php-fpm-7.3.16-1.el7.remi.x86_64
 2 
 3 /etc/logrotate.d/php73-php-fpm
 4 /etc/opt/remi/php73/php-fpm.conf
 5 /etc/opt/remi/php73/php-fpm.d
 6 /etc/opt/remi/php73/php-fpm.d/www.conf
 7 /etc/opt/remi/php73/sysconfig/php-fpm
 8 /etc/systemd/system/php73-php-fpm.service.d
 9 /opt/remi/php73/root/usr/sbin/php-fpm
10 /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6
11 /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/php-fpm.conf.default
12 /opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/www.conf.default
13 /opt/remi/php73/root/usr/share/fpm
14 /opt/remi/php73/root/usr/share/fpm/status.html
15 /opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6
16 /opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6/fpm_LICENSE
17 /opt/remi/php73/root/usr/share/man/man8/php-fpm.8.gz
18 /usr/lib/systemd/system/php73-php-fpm.service
19 /var/opt/remi/php73/lib/php/opcache
20 /var/opt/remi/php73/lib/php/session
21 /var/opt/remi/php73/lib/php/wsdlcache
22 /var/opt/remi/php73/log/php-fpm
23 /var/opt/remi/php73/run/php-fpm

查找php.ini位置:

1 [root@xxx etc]# find /etc/opt/remi/php73 -name php.ini
2 /etc/opt/remi/php73/php.ini

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

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

重启php73-php-fpm

1 systemctl restart php73-php-fpm

更多操作:

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

查看 PHP
验证一下是否安装成功:

1 root@mf88.biz-service:~# php73 -v
2 PHP 7.3.0-1+(cli) (built: Dec  6 2018 20:24:55) ( NTS )
3 Copyright (c) 1997-2018 The PHP Group
4 Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
5     with Zend OPcache v7.3.0-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

 

 

-----分界线-----

更新 PHP(暂时不用,不需要执行!!)
运行下面的命令系统就会更新所有可以更新的软件包括 PHP

1 yum update

安装更多组件(暂时不用,不需要执行!!)
上面的一条命令安装 PHP 只是安装了部分 PHP 拓展,更多的软件可见:

 1 # yum search php73
 2 Updating Subscription Management repositories.
 3 Last metadata expiration check: 0:27:54 ago on Wed 15 May 2019 10:39:52 AM EDT.
 4 ============================================================================================= Name Exactly Matched: php73 ==============================================================================================
 5 php73.x86_64 : Package that installs PHP 7.3
 6 php73.x86_64 : Package that installs PHP 7.3
 7 ============================================================================================ Name & Summary Matched: php73 =============================================================================================
 8 php73-syspaths.x86_64 : System-wide wrappers for the php73 package
 9 php73-syspaths.x86_64 : System-wide wrappers for the php73 package
10 php73-scldevel.x86_64 : Package shipping development files for php73
11 php73-scldevel.x86_64 : Package shipping development files for php73
12 php73-php-zstd-devel.x86_64 : php73-php-zstd developer files (header)
13 php73-runtime.x86_64 : Package that handles php73 Software Collection.
14 php73-runtime.x86_64 : Package that handles php73 Software Collection.
15 php73-runtime.x86_64 : Package that handles php73 Software Collection.
16 php73-php-pecl-psr-devel.x86_64 : php73-php-pecl-psr developer files (header)
17 php73-php-pecl-psr-devel.x86_64 : php73-php-pecl-psr developer files (header)
18 php73-php-pecl-raphf-devel.x86_64 : php73-php-pecl-raphf developer files (header)
19 php73-php-pecl-raphf-devel.x86_64 : php73-php-pecl-raphf developer files (header)
20 php73-php-pecl-propro-devel.x86_64 : php73-php-pecl-propro developer files (header)
21 php73-php-pecl-yaconf-devel.x86_64 : php73-php-pecl-yaconf developer files (header)
22 php73-php-pecl-propro-devel.x86_64 : php73-php-pecl-propro developer files (header)
23 php73-php-pecl-yaconf-devel.x86_64 : php73-php-pecl-yaconf developer files (header)
24 php73-php-pecl-xmldiff-devel.x86_64 : php73-php-pecl-xmldiff developer files (header)
25 php73-php-pecl-swoole4-devel.x86_64 : php73-php-pecl-swoole4 developer files (header)
26 php73-php-pecl-xmldiff-devel.x86_64 : php73-php-pecl-xmldiff developer files (header)
27 php73-php-zephir-parser-devel.x86_64 : php73-php-zephir-parser developer files (headers)
28 php73-php-zephir-parser-devel.x86_64 : php73-php-zephir-parser developer files (headers)
29 php73-php-pecl-handlebars-devel.x86_64 : php73-php-pecl-handlebars developer files (header)
30 ================================================================================================= Name Matched: php73 ==================================================================================================
31 php73-php.x86_64 : PHP scripting language for creating dynamic web sites
32 php73-php.x86_64 : PHP scripting language for creating dynamic web sites
33 php73-build.x86_64 : Package shipping basic build configuration
34 ……

 

转:https://blog.csdn.net/laohe08/article/details/93166590

 

标签:x86,fpm,php73,php7.3,centos7,remi,64,yum,php
来源: https://www.cnblogs.com/yiyaxuan/p/12652030.html