配置LANMP环境(6)-- 安装APACHE与PHP配置
一、安装 Apache 2.4
安装:默认安装2.4版本
yum install httpd
修改配置
vim /etc/httpd/conf/httpd.conf
42行80端口改为 8080
查看行号: :set nu
启动apache:
systemctl start httpd
配置开机自动启动apache:
systemctl enable httpd
访问虚拟主机的ip:
8080查看是否启动成功
二、安装PHP
安装5.6
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 yum install --enablerepo=remi --enablerepo=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-xml php-bcmath php-process php-gd php-common php-redis php-memcached
安装7.0
1、如果之前已经安装我们先卸载一下
yum -y remove php*
2、由于linux的yum源不存在php7.x,所以我们要更改yum源
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
3.yum 安装php72w和各种拓展,选自己需要的即可
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-g
安装好之后查看php的版本:
php -v