centos7安装php7
显示的是在现有的安装源中能够安装的最新版本
yum provides php
在安装PHP7之前,建议先升级更新一下CentOS7的安装包
yum -y upgrade
完成后,重启httpd
systemctl restart httpd.service
移除CentOS7 已安装的php-common
yum remove php-common -y
安装php源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
查看目前能够安装的PHP版本
yum list php*
安装php
yum -y install php72w
yum install php72w-common php72w-fpm php72w-opcache php72w-gd php72w-mysqlnd php72w-mbstring php72w-pecl-redis php72w-pecl-memcached php72w-devel
以下为常用扩展
php72w mod_php , php72w-zts
php72w-bcmath
php72w-cli php-cgi, php-pcntl, php-readline
php72w-dba
php72w-devel
php72w-embedded php-embedded-devel
php72w-enchant
php72w-fpm
php72w-gd
php72w-imap
php72w-interbase php_database, php-firebird
php72w-intl
php72w-ldap
php72w-mbstring
php72w-mcrypt
php72w-mysql php-mysqli, php_database
php72w-mysqlnd php-mysqli, php_database
php72w-odbc php-pdo_odbc, php_database
php72w-opcache php72w-pecl-zendopcache
php72w-pdo php72w-pdo_sqlite, php72w-sqlite3
php72w-pdo_dblib php72w-mssql
php72w-pear
php72w-pecl-apcu
php72w-pecl-imagick
php72w-pecl-memcached
php72w-pecl-mongodb
php72w-pecl-redis
php72w-pecl-xdebug
php72w-pgsql php-pdo_pgsql, php_database
php72w-phpdbg
php72w-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php72w-pspell
php72w-recode
php72w-snmp
php72w-soap
php72w-tidy
php72w-xml php-dom, php-domxml, php-wddx, php-xsl
php72w-xmlrpc
上面所有模块
yum -y install php72w php72w-bcmath php72w-cli php72w-dba php72w-devel php72w-embedded php72w-enchant php72w-fpm php72w-gd php72w-imap php72w-interbase php72w-intl php72w-ldap php72w-mbstring php72w-mcrypt php72w-mysql php72w-mysqlnd php72w-odbc php72w-opcache php72w-pdo php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick php72w-pecl-memcached php72w-pecl-mongodb php72w-pecl-redis php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xml php72w-xmlrpc
验证php是否安装成功
php -v
验证对应的扩展是否安装成功
php -m
设置php-fpm并检测php-fpm的运行状态
启动php-fpm
service php-fpm start
检查启动是否成功
service php-fpm status
设置开机自启动
systemctl enable php-fpm.service
检查开机自启动是否设置成功
systemctl list-dependencies | grep php-fpm
ps -ef | grep php-fpm
记得重启Apache