广告:宝塔Linux面板高效运维的服务器管理软件 点击【 https://www.bt.cn/p/uNLv1L 】立即购买
本篇文章给大家介绍一下CentOS7使用yum安装PHP7.3的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
CentOS 7 yum安装 PHP7.3 教程
1、首先安装 EPEL 源:
yum install epel-release登录后复制
安装 REMI 源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm登录后复制
2、安装 Yum 源管理工具:
yum install yum-utils登录后复制
3、安装 PHP7.3:
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
设置开机启动、运行服务:
systemctl enable php73-php-fpmsystemctl start php73-php-fpm登录后复制
设置 PHP
查找安装包:
[root@xxx etc]# rpm -qa | grep 'php'php73-php-cli-7.3.6-1.el7.remi.x86_64php73-php-mbstring-7.3.6-1.el7.remi.x86_64php73-php-pecl-mcrypt-1.0.2-1.el7.remi.x86_64php73-runtime-2.0-1.el7.remi.x86_64php73-php-pdo-7.3.6-1.el7.remi.x86_64php73-php-bcmath-7.3.6-1.el7.remi.x86_64php73-php-fpm-7.3.6-1.el7.remi.x86_64php73-php-mysqlnd-7.3.6-1.el7.remi.x86_64php73-php-snmp-7.3.6-1.el7.remi.x86_64php73-php-gd-7.3.6-1.el7.remi.x86_64php73-php-json-7.3.6-1.el7.remi.x86_64php73-php-soap-7.3.6-1.el7.remi.x86_64php73-php-recode-7.3.6-1.el7.remi.x86_64php73-php-pecl-crypto-0.3.1-5.el7.remi.x86_64php73-php-common-7.3.6-1.el7.remi.x86_64php73-php-opcache-7.3.6-1.el7.remi.x86_64php73-php-pecl-geoip-1.1.1-6.el7.remi.x86_64登录后复制
找到:php73-php-fpm-7.3.6-1.el7.remi.x86_64安装位置
[root@xxx etc]# rpm -ql php73-php-fpm-7.3.6-1.el7.remi.x86_64/etc/logrotate.d/php73-php-fpm/etc/opt/remi/php73/php-fpm.conf/etc/opt/remi/php73/php-fpm.d/etc/opt/remi/php73/php-fpm.d/www.conf/etc/opt/remi/php73/sysconfig/php-fpm/etc/systemd/system/php73-php-fpm.service.d/opt/remi/php73/root/usr/sbin/php-fpm/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/php-fpm.conf.default/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.6/www.conf.default/opt/remi/php73/root/usr/share/fpm/opt/remi/php73/root/usr/share/fpm/status.html/opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6/opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.6/fpm_LICENSE/opt/remi/php73/root/usr/share/man/man8/php-fpm.8.gz/usr/lib/systemd/system/php73-php-fpm.service/var/opt/remi/php73/lib/php/opcache/var/opt/remi/php73/lib/php/session/var/opt/remi/php73/lib/php/wsdlcache/var/opt/remi/php73/log/php-fpm/var/opt/remi/php73/run/php-fpm登录后复制
查找php.ini位置:
[root@xxx etc]# find /etc/opt/remi/php73 -name php.ini/etc/opt/remi/php73/php.ini登录后复制
编辑/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登录后复制
重启php73-php-fpm
systemctl restart php73-php-fpm登录后复制
更多操作:
systemctl restart php73-php-fpm #重启systemctl start php73-php-fpm #启动systemctl stop php73-php-fpm #关闭systemctl status php73-php-fpm #检查状态登录后复制
查看 PHP
验证一下是否安装成功:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm1登录后复制
更新 PHP
运行下面的命令系统就会更新所有可以更新的软件包括 PHP
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm2登录后复制
安装更多组件
上面的一条命令安装 PHP 只是安装了部分 PHP 拓展,更多的软件可见:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm3登录后复制
推荐学习:php视频教程
以上就是CentOS7如何使用yum安装PHP7.3的详细内容,更多请关注9543建站博客其它相关文章!
发表评论