你的位置:首页 > 操作系统

[操作系统]Centos下yum安装PHP


添加 yum 源

  Centos 6.x 的源
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

  Centos 7.x 的源
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

安装 PHP

# yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-

注:安装5.6版本为remi-php56,安装5.5版本为remi-php55

查看 PHP 版本

# php -vPHP 5.6.18 (cli) (built: Feb 3 2016 10:25:33) Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies  with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies  with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans