Home > Article > Backend Development > 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; }
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.
##Open php- fpm method:
# nohup /usr/sbin/php-fpm -R >/dev/null 2>&1 &
View the php running directory command:
which php /usr/bin/php
Restart php-fpm:
/etc/init.d/php-fpm restartRelated 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!