第一步:安装remi源
yum install epel-release -y
或rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
或yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
第二步:配置php7.2仓库
yum -y install yum-utils
yum-config-manager –enable remi-php72 #yum -y install yum-utils
第三步:安装PHP
yum install php 因为上一步remi配置,所以这里会指向php72
第四步:安装扩展组件
yum install php php72-php-opcache php72-php-ldap php72-php-odbc php72-php-pear php72-php-xml php72-php-xmlrpc php72-php-soap curl curl-devel php72-php-mbstring php72-php-mysqlnd php72-php-fpm php72-php-gd php72-php-xdebug php72-php-pecl-mysql php72-php-pecl-memcached php72-php-pecl-memcache php72-php-pecl-redis
第五步:安装php-fpm
yum install php72-php-fpm
systemctl restart php72-php-fpm #启动php-fpm服务
netstat -tunlp|grep 9000 #查看9000端口是否正常启动了
php的配置文件及组件的安装位置
/etc/opt/remi/php72
/etc/opt/remi/php72/php-fpm.d/*.conf
—————————
安装xdebug
搜索相应库:yum search php|grep xdebug
yum install php72-php-pecl-xdebug
CentOS 7 provides PHP version 5.4 in its official repository
Command to install the EPEL repository configuration package:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Command to install the Remi repository configuration package:
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
Command to install the yum-utils package (for the yum-config-manager command):
yum install yum-utils
You want a single version which means replacing base packages from the distribution
Packages have the same name than the base repository, ie php-*
Some common dependencies are available in remi-safe repository, which is enabled by default
PHP version 7.2 packages are available for CentOS 7 in remi-php72 repository
Command to enable the repository:
yum-config-manager --enable remi-php72
If the priorities plugin is enabled, ensure remi-php72 have higher priority (a lower value) than base and updates
Command to upgrade (the repository only provides PHP):
yum update
Command to install additional packages:
yum install php-xxx
Command to install testing packages:
yum --enablerepo=remi-php72-test install php-xxx
Command to check the installed version and available extensions:
php --version
php --modules