centos安装PHP

一、centos6安装php

1、添加源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

2、安装PHP及扩展

yum install php71w php71w-fpm php71w-opcache php71w-mysqlndphp71w-bcmath php71w-gd php71w-mcrypt php71w-mbstring php71w-odbc php71w-xml php71w-cli php71w-common

注:可使用yum search php查找版本,然后按自己的需要来安装PHP版本

3、启动PHP

/etc/init.d/php-fpm start


二、centos7安装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

————————————————

#yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

————————————————

#yum install php70w-fpm php70w-opcache

注:可使用yum search php查找版本,然后按自己的需要来安装PHP版本

#systemctl start php-fpm

#systemctl enable php-fpm


安装 php7.2

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

yum install php72w php72w-cli php72w-common php72w-gd php72w-mbstring php72w-mcrypt php72w-mysqlnd php72w-xml php72w-fpm php72w-devel php72w-pdo php72w-pecl-redis php72w-opcache

你可能感兴趣的:(centos安装PHP)