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

How does apache support php7

王林
Release: 2019-10-19 11:53:36
Original
4432 people have browsed it

How does apache support php7

apache支持php7的设置方法:

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

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

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"
Copy after login

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

DocumentRoot "${SRVROOT}/www"
<Directory "${SRVROOT}/www">
Copy after login

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

AddType application/x-httpd-php .php
Copy after login

5、将 apache 安装成系统服务

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

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

<?php
phpinfo();
?>
Copy after login

推荐教程: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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template