系统相关
首页 > 系统相关> > Centos7 安装php

Centos7 安装php

作者:互联网

今天学习php的安装 ,记录一下学习过程;

先安装好了mysql,才能跟php进行配套使用;

1.安装php的环境;

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

2.安装php,以及安装mysql数据库的驱动

yum install php php-fpm php-mysql -y

3.php跟apche结合工作

编辑apche的配置文件

vim /etc/httpd/conf/httpd.conf

4.进行配置文件的修改

输入/DocumentRoot查找

/DocumentRoot "/var/www/html"

插入:

TypesConfig /etc/mime.types

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

DirectoryIndex index.php index.html

5.编写一个php脚本来测试是否成功

vim /var/www/html/index.php

i 插入

<?php
    Phpinfo();
?>
esc,shift :wq保存退出
stemctl restart httpd 重启apche服务查看php内容
到这里就成功了。

 

标签:index,httpd,安装,Centos7,mysql,php,php72w
来源: https://www.cnblogs.com/tang1995/p/16278944.html