Home > Operation and Maintenance > Apache > How to communicate between apache and php

How to communicate between apache and php

(*-*)浩
Release: 2019-08-24 18:08:41
Original
3781 people have browsed it

Many junior engineers are confused about this piece of knowledge, because the work these students do generally does not involve too many architectural things in their responsibilities or projects, but I think it is necessary to learn one thing. Only when you know what it is and why it is so can you continue to expand your depth and breadth in this field. Today I will give a systematic explanation.

How to communicate between apache and php

The main communication methods between php and apache are divided into the following three methods

cgi mode

Let’s first explain what cgi is in layman’s terms?

First of all, cgi is a specification. The Chinese explanation is a universal gateway interface, which is actually between the web server and php A translator, when the web server receives a request, if you use this method, because the browser can only recognize html or other static information, cgi will make php code for you Conversion

How should it be configured specifically in apache?

# 对 PHP 5 用这行
Action application/x-httpd-php “/php/php-cgi.exe”
Copy after login

Modular approach

Popular explanation of modular approach:

In modularization (DLL), PHP is related to the Web server If they are started and run at the same time, to put it more simply, they are running as the same process.

So how to configure it specifically?

# 对 PHP 5 用这两行:
LoadModule php5_module “c:/php/php5apache2.dll”
AddType application/x-httpd-php .php
# 配置 php.ini 的路径
PHPIniDir “C:/php”
Copy after login

fastcgi

Popular explanation:

To put it bluntly, fastcgi is also a protocol. It is a cgi manager, so its specific implementation In php, it is the php-fpm module of php, but in apache, it uses a special fastcgi module, which needs to download the .so file. After php5.3, php-fpm is no longer a third-party module but is integrated into php. , it will start multiple cgi programs in advance, manage these processes, and provide reasonable and effective scheduling to ensure concurrency.

For more Apache related technical articles, please visit Apache usage tutorial column for learning!

The above is the detailed content of How to communicate between apache and 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