CentOS下安装php及Apache(yum 安装)
1、安装epel
yum install epel-release -y
2.安装REMI源:
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
3.查看可以安装的PHP版本:
yum repolist all | grep php
4.安装管理工具
yum install yum-utils
5.设置默认安装的版本
yum-config-manager --enable remi-php73
6.安装php
yum install php
7.查看php安装版本
php -v
8.查看哪些可以安装的PHP扩展
yum search php74-php
9.安装php拓展
yum install php74-php-bcmath php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php-mysqlnd php74-php-simplexml php74-php-devel
10.运行php
systemctl start php74-php-fpm.service
11.查看php扩展
php -m
12.安装Apache
yum install httpd
13.启动并查看Apache
systemctl start httpd.service
systemctl status httpd.service
systemctl enable httpd
14.修改Apache配置
find / -name httpd.conf
vim /etc/httpd/conf/httpd.conf
ServerName www.osyunwei.com:80
LoadModule php7_module modules/libphp7.so
<IfModule mod_php7.c>
AddType application/x-httpd-php .php
</IfModule>