Home  >  Article  >  Operation and Maintenance  >  How does apache support php7

How does apache support php7

王林
王林Original
2019-10-19 10:28:364414browse

How does apache support php7

apache支持php7的设置方法:

1、修改 SRVROOT,这里定义了 apache 的安装路径,相当于一个变量,后面很多地方会用到这个变量

# 修改37行,将其改为
Define SRVROOT "D:\\Program Files\\Apache24"

2、查找 LoadModule,在其后面增加下面配置,知道 php 模块,和 php 配置文件地址

LoadModule php7_module "D:\\Program Files\\php-7.3.5\\php7apache2_4.dll"
PHPIniDir "D:\\Program Files\\php-7.3.5"

3、修改根路径,修改DocumentRoot和Directory,改为如下:

DocumentRoot "${SRVROOT}/www"
<Directory "${SRVROOT}/www">

4、新增一个配置,让 apache 识别 php 的文件

AddType application/x-httpd-php .php

5、将 apache 安装成系统服务

# 安装/卸载apache服务
httpd -k install/remove
# 启动/关闭/重启 apache服务
httpd -k start/stop/restart

6、测试是否成功。在D:\Program Files\Apache24\www路径下新建一个phpinfo.php文件,内容如下:

<?php
phpinfo();
?>

推荐教程:apache教程

The above is the detailed content of How does apache support php7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn