PHP安装和部署
一、关闭防火墙
二、安装EPEL源、REMI源、yum源管理工具、PHP 7.3
①安装epel源
[root@localhost yum.repos.d]# yum install epel-release
[root@localhost yum.repos.d]# ls /etc/yum.repos.d/
epel.repo epel-testing.repo
②安装remi源
[root@localhost yum.repos.d]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@localhost yum.repos.d]# ls
remi-php71.repo remi-php72.repo remi-glpi91.repo remi-php73.repo remi-glpi92.repo remi-php74.repo remi-glpi93.repo remi-php80.repo remi-glpi94.repo remi-php81.repo remi-modular.repo remi.repo remi-php54.repo remi-safe.repo epel.repo remi-php70.repo
③安装yum源管理工具
[root@localhost yum.repos.d]# yum -y install yum-utils
④安装PHP 7.3
[root@localhost yum.repos.d]# yum -y install 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服务
[root@localhost yum.repos.d]# systemctl restart php73-php-fpm #重启php, 开机自启enable
四、设置PHP
①查看安装包
[root@localhost yum.repos.d]# rpm -qa | grep php
oniguruma5php-6.9.8-1.el7.remi.x86_64
php73-php-pdo-7.3.33-1.el7.remi.x86_64
php73-php-mysqlnd-7.3.33-1.el7.remi.x86_64
php73-php-pecl-mcrypt-1.0.5-1.el7.remi.x86_64
php73-php-opcache-7.3.33-1.el7.remi.x86_64
php73-runtime-2.0-1.el7.remi.x86_64
php73-php-fpm-7.3.33-1.el7.remi.x86_64
②查看PHP安装位置
[root@localhost yum.repos.d]# rpm -ql php73-php-fpm-7.3.33-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.33
/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.33/php-fpm.conf.default
/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.33/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.33
/opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.33/fpm_LICENSE
/opt/remi/php73/root/usr/share/man/man8/php-fpm.8.gz
/usr/lib/systemd/system/php73-php-fpm.service
③查找PHP配置文件所在位置
[root@localhost yum.repos.d]# find /etc/opt/remi/php73/ -name php.ini
/etc/opt/remi/php73/php.ini
④设置快捷命令
⑤PHP管理命令
[root@localhost yum.repos.d]# systemctl restart php73-php-fpm #重启
[root@localhost yum.repos.d]# systemctl stop php73-php-fpm #关闭
[root@localhost yum.repos.d]# systemctl start php73-php-fpm #启动
[root@localhost yum.repos.d]# systemctl status php73-php-fpm #查看状态
⑥查看PHP版本信息
[root@localhost yum.repos.d]# php73 -v
PHP 7.3.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.33, Copyright (c) 1999-2018, by Zend Technologies
⑦更新PHP
[root@localhost yum.repos.d]# yum update
[root@localhost yum.repos.d]# systemctl restart php73-php-fpm #重启