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.
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”
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”
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!

ApacheHTTPServer remains important in modern web environments because of its stability, scalability and rich ecosystem. 1) Stability and reliability make it suitable for high availability environments. 2) A wide ecosystem provides rich modules and extensions. 3) Easy to configure and manage, and can be quickly started even for beginners.

The reasons for Apache's success include: 1) strong open source community support, 2) flexibility and scalability, 3) stability and reliability, and 4) a wide range of application scenarios. Through community technical support and sharing, Apache provides flexible modular design and configuration options, ensuring its adaptability and stability under a variety of needs, and is widely used in different scenarios from personal blogs to large corporate websites.

Apachebecamefamousduetoitsopen-sourcenature,modulardesign,andstrongcommunitysupport.1)Itsopen-sourcemodelandpermissiveApacheLicenseencouragedwidespreadadoption.2)Themodulararchitectureallowedforextensivecustomizationandadaptability.3)Avibrantcommunit

Apache's performance and flexibility make it stand out in a web server. 1) Performance advantages are reflected in efficient processing and scalability, which are implemented through multi-process and multi-threaded models. 2) Flexibility stems from the flexibility of modular design and configuration, allowing modules to be loaded and server behavior adjusted according to requirements.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools