Home > Operation and Maintenance > Apache > How apache parses php

How apache parses php

(*-*)浩
Release: 2019-10-29 14:30:06
Original
5395 people have browsed it

How apache parses php

Detailed explanation of configuring the Apache server to support PHP file parsing

[Description] (Recommended learning: apache Use )

1. In this example, the Apache version is httpd-2.4.20-x64-vc14, and the installation path is E:\Apache24

2. The PHP version is php-5.5 .34-Win32-VC11-x64, the installation path is E:\php-5.5.34

[Download]

Log in to http://php.NET/ downloads.php Download PHP. Since I want to integrate it with Apache, I downloaded the Thread Safe version here;

[Installation]

1. Unzip and download file, in this example I will decompress the compressed package to the root directory of drive E;

[Configuration]

1. Use a text editor to open E:\Apache24\conf \httpd.conf file, find #LoadModule vhost_alias_module modules/mod_vhost_alias.so and add the following configuration on the next line:

# 以 module 方式加载 php 
LoadModule php5_module "E:/php-5.5.34/php5apache2_4.dll"
# 指明 php 配置文件 php.ini 的位置 
PHPIniDir "E:/php-5.5.34"
Copy after login

2. Find AddType application/x-gzip .gz .tgz and add on the next line Configure as follows:

# 定义能够执行 php 的文件类型,即.php和.html的文件能执行PHP程序 
AddType Application/x-httpd-php .php .html
Copy after login

3. Rename E:\php-5.5.34\php.ini-development to E:\php-5.5.34\php.ini and open php.ini with a text editor file, go to the extension_dir = "./" line, remove the comment and replace it with extension_dir = "E:/php-5.5.34/ext";

extension_dir = "E:/php-5.5.34/ext"
Copy after login

4. Restart the Apache server;

【Test】

1. Write the test.php file and save the file to the website path of the Apache server. The file content is as follows:

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

Open http://localhost/test.php in the browser. When the following page appears, it means that Apache has supported the parsing of PHP files;

How apache parses php

The above is the detailed content of How apache parses php. 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