Linux 下 YUM 安装 PHP 5.5 (及5.6)

时间:2022-12-23 16:13:08

原文链接: http://blog.aboutc.net/linux/50/yum-install-php-on-linux

系统环境:

  • CentOS 6.4 x86_64
  • Fedora 20 x86_64

Fedora 20 源中已经有了PHP的源,直接可以使用以下命令安装即可:

# yum install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt

以下为 CentOS 下安装 PHP 方法:

添加 epel 源

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

添加 remi 源

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

安装 PHP

# yum --enablerepo=remi,remi-php55 install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt

查看 PHP 版本

# php -v
PHP 5.5.9 (cli) (built: Feb 11 2014 08:25:33)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

启动 php-fpm

# service php-fpm start
Starting php-fpm: [ OK ]

php-fpm 服务常用参数 start/stop/restart/reload

-------------------------------------------------------------------------------------------

附上 yum 安装 php 5.6 方法

原文地址:  https://centos.pkgs.org/6/ius-x86_64/php56u-5.6.32-2.ius.centos6.x86_64.rpm.html

rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm

yum php56u php56u-mysql php56u-gd php56u-xml php56u-mbstring php56u-ldap php56u-pear php56u-xmlrpc php56u-bcmath