Home > Backend Development > PHP Tutorial > Talk about fastcgi and php-fpm in php!

Talk about fastcgi and php-fpm in php!

青灯夜游
Release: 2023-04-09 11:08:01
forward
2806 people have browsed it

Talk about fastcgi and php-fpm in php!

fastcgi is platform-independent and language-independent. As long as any language is implemented according to its interface, it can realize the fastcgi capability of its own language and communicate with the web server.

PHP-CGI is the FastCGI manager implemented by PHP.

FastCGI is a protocol that serves as a bridge between applications and WEB servers. Nginx cannot communicate directly with PHP-FPM, but passes the request to PHP-FPM for processing through FastCGI.

 location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
Copy after login

Here fastcgi_pass forwards all php requests to php-fpm for processing. You can see through the netstat command that the process running on the port 127.0.0.1:9000 is php-fpm.

Talk about fastcgi and php-fpm in php!

##Open php- fpm method:

# nohup /usr/sbin/php-fpm -R >/dev/null 2>&1 &
Copy after login

View the php running directory command:

which php
/usr/bin/php
Copy after login

Restart php-fpm:

/etc/init.d/php-fpm restart
Copy after login
Related tutorial recommendations: "

PHP Tutorial"

The above is the detailed content of Talk about fastcgi and php-fpm in php!. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
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