Bobcares

What to do when your PHP sites running on PHP-FPM stop working

by | Jul 15, 2017

A single downtime or error can badly affect an online business. In our role as Outsourced hosting support specialists for web hosts, we encounter and resolve many web server issues in our customers’ servers.

Most webservers such as Apache, NginX etc. make use of additional tools and modules to improve their performance and speed up the sites. PHP FPM (FastCGI Process Manager) is one such tool that speeds up PHP sites.

See how we help web hosting companies

Recently, we were contacted by a web host who was worried that the PHP sites in his server had stopped working fine and was showing ‘503 temporarily unavailable’ error. Upon investigating the server, we could see that it was configured to use PHP-FPM.

The FastCGI Process Manager (PHP-FPM) was configured in the server to reduce the amount of system resources used by web server. The web server acts as a proxy and passes only files ending with the .php file extension to PHP-FPM.

Using PHP-FPM also allows each virtual host to be configured to run PHP code as individual users, similar to the feature provided by SuPHP. But any issue with the PHP-FPM can cause PHP sites to stop working.

To pin point that the issue is due to PHP-FPM and to get the sites back to working, we immediately switched the PHP handler to Fast-CGI and minimised the website downtime.

[ You don’t have to lose your sleep over server errors. Our expert hosting specialists are online 24/7/365 to help you fix all server errors. ]

How to resolve when PHP sites running on PHP-FPM stop working

PHP-FPM works with the concept of pools, using which we can control the amount of resources dedicated to each virtual host, and also run PHP scripts as different users.

The FCGI URL in the virtual host entry would have this pattern, and it must contain the exact path to the document root.

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/mysite/$1

This given directive forwards all requests for “.php” files to FCGI server at 127.0.0.1:9000 as that is where the PHP FPM process manager would be running.

When a web server related issue happens, we first recreate the issue and then scan the error logs to detect the reason for the issue. We’ve come across different causes for the PHP FPM to mess up sites.

  1. Load the correct configuration file – Each domain has a virtual host file, which needs to be configured with the settings for its custom PHP-FPM pool. If this config file is not properly detected by the web server or settings are made in different file, it may not work fine.
  2. Permissions of socket file – FPM process manager can either listen to a socket in the server or a TCP port. If the socket doesn’t have adequate permissions or if the port is not accepting connections, FPM cannot work.
  3. Ensure that the settings in the config file are correct – The main settings in a virtual host are the ServerName (domain name) and the DocumentRoot (locations for domain files). For PHP-FPM, there is a directive called ‘ProxyPassMatch’, which helps it to act as a reverse proxy to handle web server requests coming to default web server port 80. If any of these directives are wrongly configured, it can cause PHP sites to stop working.

Upon detailed investigation in the server, we could see that the connections for the localhost to the FPM port was not working fine, which caused the sites to stop working.

After allowing the connectivity to the FPM port in the server firewall and updating the port correctly in the config file, the site started loading with PHP-FPM.

[ Use your time to build your business. We’ll take care of your customers. Hire our hosting support experts to maintain your servers secure and stable 24/7 . ]

At Bobcares, our 24/7 server specialists constantly monitor all the services in the server and proactively audit the server for any errors or corruption in them.

With our systematic debugging approach for service or other software errors, we have been able to provide an exciting support experience to the customers.

If you would like to know how to avoid downtime for your customers due to errors or other service failures, we would be happy to talk to you.

 

BOOST YOUR HOSTING BUSINESS!

Never again lose customers to server errors! Sign Up once. Enjoy Peace Of Mind For Ever!

CLICK HERE FOR WORLD-CLASS HOSTING SUPPORT

var google_conversion_label = "zWG9CLOojHIQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF