Home >Backend Development >PHP Tutorial >Apache - Integrate PHP

Apache - Integrate PHP

WBOY
WBOYOriginal
2016-07-30 13:29:241213browse
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/48208813

The operation of integrating PHP with Apache is very simple. You only need to modify the corresponding configuration file. Let's integrate it together.

1. Preparation

First go to http://www.apache.org to download the apache server, and go to http://www.php.net/ to download php

After the download is completed, install apache (I will not introduce how to install it here) Apache), decompress the downloaded php (php does not need to be installed, just configure it after decompression), put the php and apache installation directories together. The details are as follows:

2. Configuration

1) Modify Apache’s httpd.conf file

Open the httpd.conf file in the apache installation directory and add the following code template

LoadModule php5_module ~php安装路径/php5apache2_2.dll
PHPIniDir "~php模块安装路径"
AddType application/x-httpd-php .php .phtml
where ~php installation path represents PHP Specific installation directory
For example: My PHP installation directory is: D:Program Files (x86)Apache Software Foundationphp-5.6.13

So the code I configured in apache’s httpd.conf is as follows:

#载入PHP处理模块
LoadModule php5_module D:/Program Files (x86)/Apache Software Foundation/php-5.6.13/php5apache2_4.dll
#指定PHP的ini文件,该文件是对PHP的一些配置
PHPIniDir "D:/Program Files (x86)/Apache Software Foundation/php-5.6.13"
#当有一个资源是*.php的时候就由php处理
AddType application/x-httpd-php .php .phtml
is as shown below:

2) Modify the file name

Modify the php.ini-development file in the php installation directory to the php.ini file

3) Modify the php.ini file

Open the php file and find the one shown below Code

Modify the code snippet in the above picture to the code snippet as shown below:

3. Test

Create a new test.php file and write the following code in the file:

<?php
	phpinfo();
?>
Enter http://localhost/test.php in the browser and the test is successful

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above has introduced Apache - integrating PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

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