CentOS 7 yum install PHP7.3

Install PHP

The Remi software source mainly provides the latest version of the PHP package and some other PHP extension toolkits. It is for Fedora and RHEL branch variants (including: RHEL, CentOS, Oracle Linux, etc.) To install PHP, it is recommended to use the Remi software source . Remi is very active in supporting and updating PHP, and can get support for new versions as soon as possible.

Install EPEL sources and source management tools:


yum install epel-release yum-utils

Install the REMI sources:


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

Install PHP7.3 and extensions:


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-pecl-swoole php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll

php73 -v #查看版本

systemctl enable php73-php-fpm #开启开机自启

systemctl restart php73-php-fpm #重启

systemctl start php73-php-fpm #启动

systemctl stop php73-php-fpm #关闭

systemctl status php73-php-fpm #检查状态

Configuration file path:


#查找php.ini位置:

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

# The current PHP memory limit is below the recommended value of 512MB.

vi /etc/opt/remi/php73/php.ini

memory_limit = 512M

#如果你运行的是 nginx 而不是 apache,修改

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

user = apache

group = apache

# Replace the values with

user = nginx

group = nginx

#查找 php 和扩展的安装包:

rpm -qa | grep 'php'

#查看 php73-php-pecl-swoole4-4.4.15-1.el7.remi.x86_64 的安装路径:

rpm -ql php73-php-pecl-swoole4-4.4.15-1.el7.remi.x86_64

set php:


# 将php73链接到系统环境变量中,就可以使用 php -v

ln -s /opt/remi/php73/root/usr/bin/php /usr/bin/php

# 将 cgi.fix_pathinfo 设置为 0

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

关于 cgi.fix_pathinfo 选项请查看(https://taobig.org/?p=650)

潜在的漏洞风险,关于安全隐患的问题可查看(http://www.laruence.com/2010/05/20/1495.html)

Install more extensions:

Currently only some PHP extensions are installed, more extensions can be seen:


yum search php73

Update PHP:


yum update #更新可更新的所有软件,包括PHP

Guess you like

Origin blog.csdn.net/u012322399/article/details/113940884