[root@localhost modules]# rpm -q centos-release centos-release-7-5.1804.el7.centos.x86_64
一、yum安装PHP
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum list installed | grep php | awk '{print $1}' | yum remove
2.配置epel源
yum install -y epel-release wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
配置remi源
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)
yum list --enablerepo=remi --enablerepo=remi-php56 | grep '@remi-php56'
3.安装php5.6.x
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-pear php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof --skip-broken
4.安装php-fpm
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
5.配置开机启动服务
systemctl enable php-fpm
6.启动php-fpm
systemctl restart php-fpm
7.查看是否安装成功
ps -ef | grep php netstat -anp | grep 9000
安装其他扩展
yum install --enablerepo=remi --enablerepo=remi-php56 php-扩展名称 php-扩展名称2
支持的扩展列表:
bcmath bz2 calendar crypto ctype curl dbase dba dom exif fileinfo ftp gd geoip gettext iconv igbinary imap interbase json ldap lua mbstring mcrypt memcached mongo msgpack mysqli mysqlnd mysql oauth odbc opcache pdo_firebird pdo_mysql pdo_odbc pdo pdo_sqlite phar posix quickhash recode redis rrd seaslog shmop simplexml snmp soap sockets solr sphinx sqlite3 sqlite ssh2 stomp svn sync sysvmsg sysvsem sysvshm tidy tokenizer trader wddx xdebug xhprof xmldiff xmlreader xml xmlwriter xsl yaf yaml yar yaz zip