PHP-FPM (an acronym of FastCGI Process Manager) is a hugely-popular alternative PHP (Hypertext Processor) FastCGI implementation.
As you may or may not know, PHP is one of the biggest open-source software programming languages utilized online. It features heavily in web development across such well-known platforms as Drupal, Magento, and WordPress, and was originally devised to preprocess plain text in UTF-8.
When PHP was invented by Rasmus Lerdorf in the mid-’90s, it was one of the first languages capable of featuring within HTML coding with no need to call external files.
Lerdorf’s scripting language has continued to evolve over the decades since, and it’s now supported by any web platform or operating system. However, as PHP’s publication is under the PHP licence, it’s incompatible with GNU General Public License because of restrictions related to the PHP term.
PHP-FPM Key Features
PHP-FPM includes numerous features that can prove beneficial for websites receiving traffic in large volumes frequently. These are:
- Ability to start workers using various uid/gid/chroot/environment and php.ini, which replaces the safe mode users may expect
- In-depth management for simple stop/start processing
- Logging of stdout and stderr
- Emergency restart available, in the event of an opcode cache being destroyed accidentally
- Support for uploads is faster
- Based on php.ini configuration files
- Slowlog variable configuration for detecting functions that take longer than usual to execute
- FastCGI improvements, with a special function for stopping and downloading data while completing long processes (e.g. processing statistics)
- Basic stats are available, similar to the mod-status module in Apache
PHP-FPM and Nginx
Nginx is the ideal combination with PHP-FPM. Why? Because it’s a stable web server recognized for its impressive performance and low resource-consumption.
It features an asynchronous structure that’s highly-scalable, according to events. On top of this, memory consumption performance is significantly better when using Nginx and PHP-FPM together.
PHP runs as an isolated service when you use PHP-FPM. Employing this PHP version as the language interpreter means requests will be processed via a TCP/IP socket, and the Nginx server handles HTTP requests only, while PHP-FPM interprets the PHP code. Taking advantage of two separate services is vital to become more efficient.
PHP-FPM and HHVM
Nobody uses HHVM (HipHop Virtual Machine) anymore, as it’s unavailable. This was an open-source virtual machine, based on the Just-in-Time (JIT) compiler, serving as a PHP and Hack execution engine.
HHVM executes PHP or Hack code in intermediate Bytecode HipHop code, through the use of the Just-in-Time compiler principle. This code is converted into machine code at a later point, before being optimized natively and, eventually, executed.
This is a stark contrast to the standard PHP interpreted execution: the Zend Engine converts PHP code into opcode, via the Zend Engine virtual CPU.
PHP’s last version, along with FPM, means the language’s performance is now the same — or even better — without needing to use HHVM. It’s compatible with the majority of PHP 7 functions.
Before PHP 7 arrived, the PHP HHVM processor (created by Facebook, available on GitHub with Zend and PHP licenses) was typically used.
PHP-FPM and WordPress
An Nginx server with PHP-FPM support is crucial if you operate an online newspaper, content platform, or WordPress site receiving a huge number of visits daily. This set up enables you to facilitate the execution of your WordPress CMS’s PHP code to a higher standard.
PHP-FPM and Magento
Magento, a popular ecommerce platform, integrates with Nginx and PHP-FPM well. If you want to achieve your online store’s top performance, you’ll need to use this web server along with PHP-FPM support. Balancer and caches are essential, too.
PHP-FPM is a very challenging topic for newcomers, but we hope this guide has shed light on it. You should feel more comfortable with PHP-FPM, its features, and everything else covered above now that you’ve read our expert insights!
PHP-FPM and Plesk
To insure high performance and low memory consumption for highly loaded web apps PHP-FPM handler is available under Plesk. You need to make sure that PHP-FPM is installed and the option “Process PHP by nginx” is on under Websites & Domains > YourDomain > Web Server Settings.
Conclusion
PHP-FPM is an efficient method on how to minimize the memory consumption and rise the performance for the websites with heavy traffic. It is significantly faster than traditional CGI-based methods in multi-user PHP environments. If your primary goal for hosting your web application is to achieve optimal performance and security, then PHP-FPM is the way forward.
4 Comments
Hey this was an amazing explanation about php fpm, but i am confused between fastcgi configuration for nginx and php fpm. Are they both same or different.?
Hi James! PHP-FPM stands for ‘PHP FastCGI Process Manager’, so they are both the same thing 🙂 Thank you!
Same confusion here. I understand why FastCGI and FPM might be the same, but i see there are 2 different settings in Plesk. Can i pick either one and it will work the same?
Hi Jose Maria,
Although both will work, you can find more information regarding the difference in PHP settings on the Documentation Portal. Hope this helps.