CentOS7 yum安装lamp环境
1.安装apache
yum install httpd #根据提示,输入Y安装即可成功安装
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动 ·
systemctl stop firewalld.service
2.检查当前安装的PHP包
yum list installed | grep php
2.1如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2.1配置 CentOS 7的yum源。
yum -y install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2.2使用yum list命令查看可安装的包(Packege)
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
3.安装PHP5.6.x
3.1yum源配置好了,下一步就安装PHP5.6。
yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd
用PHP命令查看版本。
[root@localhost ~]# php -v
PHP 5.6.36 (cli) (built: Apr 25 2018 10:02:39)
Copyright (c) 1997-2016 The PHP Group
Zend 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.5.5, Copyright (c) 2002-2017, by Derick Rethans
3.2安装PHP-fpm
yum -y install --enablerepo=remi --enablerepo=remi-php56 php-fpm
重新启动服务:
在 CentOS 7 系统上:
$ sudo systemctl restart httpd
$ sudo systemctl restart php-fpm
一个勤勤恳恳码代码的码农,爱生活,爱代码!