![]() PHP-FPM can serve more traffic than traditional PHP handlers while creating greater resource efficiency. Although the cost of starting and terminating a new web server process for each request is relatively small, the overall expense quickly increases the web server begins to handle increasing amounts of traffic. PHP-FPM can reuse worker processes repeatedly instead of having to create and terminate them for every single PHP request. The primary performance benefits from using PHP-FPM are more efficient PHP handling and the ability to use opcode caching for PHP scripts.Īs mentioned, PHP-FPM’s event-driven framework allows PHP scripts to use as much of the server’s available resources as necessary without the additional overhead that comes from running them inside of web server processes. Processing PHP scripts in this way allows for much higher processing performance, improved security, better stability, and greater configurability. PHP-FPM’s architecture shares design similarities with event-driven web servers such as the NGINX web server and the Apache web server with the Event Multi-Processing Module. Although this does increase some of the overhead of using PHP-FPM, the additional resource cost is negligible and well-offset by its other benefits. Each PHP user can have its own separate pool of worker processes for handling PHP requests. This helps to prevent memory leaks during the processing of PHP scripts. Worker processes also periodically terminate and respawn after serving a fixed number of requests. The extra worker processes it spawns to handle increases in traffic terminate only after a set amount of time has passed, allowing the worker processes to remain available while increased traffic persists. The PHP-FPM master process dynamically creates and terminates worker processes - within configurable limits - as traffic to PHP scripts increases and decreases. Once a PHP-FPM worker finishes handling a request, the system releases the worker and waits for new requests. PHP-FPM then compiles and executes the PHP script, sending the output back to the web server. As PHP-FPM receives a proxied connection, a free PHP-FPM worker accepts the web server’s request. Notably, the proxy connection for PHP-FPM is not the same as a traditional proxy connection. Although requests pass via a proxy connection, the PHP-FPM service must run on the same server as the web server. The PHP-FPM service can listen for these requests on the host server’s network ports or through Unix sockets. Internally, PHP-FPM is organized as a “ master process” managing pools of individual “ worker processes.” When the web server has a request for a PHP script, the web server uses a proxy, FastCGI connection to forward the request to the PHP-FPM service. When using PHP-FPM, a separate service specifically designed for processing PHP scripts handles the task. However, PHP-FPM provides a new experience that addresses many of the shortcomings of the previously mentioned PHP handlers (suPHP, CGI, and DSO). Running PHP this way provides a stable, mature means of using PHP scripts. They execute using the web server processes’ permissions and ownership configurations. The server compiles and executes the PHP scripts as part of the individual web server’s processes as it responds to website traffic. ![]() ![]() When using these PHP handlers, the web server tightly couples to processing PHP scripts. ![]() Traditionally, the web server handles compiling PHP scripts through integrated web server modules such as single user PHP ( suPHP), Common Gateway Interface ( CGI), or Dynamic Shared Object ( DSO, also known as mod_php). This owes to PHP-FPM’s architecture and features.įor an overview of InMotion Hosting’s WordPress Hosting platform and how PHP-FPM fits into it, please refer to our guide discussing the technologies used in the WordPress Hosting Stack.Īs a high-level programming language, PHP scripts require compiling before a web server’s underlying processor hardware can understand it. WordPress websites configured to use PHP-FPM can handle higher amounts of website traffic while using fewer server resources than other PHP handlers. PHP-FPM is an advanced, highly-efficient processor for the PHP scripting language. InMotion Hosting’s WordPress Hosting platform uses PHP-FastCGI Process Manager ( PHP-FPM) to provide the best performance for websites using the WordPress content management system (CMS). ![]()
0 Comments
Leave a Reply. |