Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
I'm trying to squeeze out just a bit more performance and I know that FastCGI is a bit faster. So how do I go about setting up FastCGI for PHP 7.4? I'm running a forum software (PHP script). Most of the articles I find on the internet and here do not cover the newest PHP 7.4 and typically the article states a directory that doesn't exist. I'm using cPanel/WHM 92.0.7.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,236
402
243
cPanel Access Level
Root Administrator
Hey there! You may want to review these documentation pages if you're going to further tweak the system for improved performance:


Let me know if that clears things up!
 

Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
No. It didn't. I can flip on the FastCGI in the PHP controls but still run in CGI mode. So how do you configure the Fast CGI to be used because so far I've never found a way. It continues to show ZERO FastCGI proecesses. There is configuration in a file or something that has to be set up.

mod_fcgid status:
Total FastCGI processes: 0
 

Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
Under WHM go to Server Status got to Apache Status. Then at the bottom of the page is mod_fcgid status: Total FastCGI processes: 0

Under WHM go to MultiPHP Manager I've got PHP 7.4 running with the PHP handler set to fcgi.

Under PHP Info if you look at $_SERVER['GATEWAY_INTERFACE'] it reports back only CGI/1.1

As far as I can find FastCGI is not running. I never see process move off ZERO even with Apache Benchmark running 2,000 connections in batches of 200.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,236
402
243
cPanel Access Level
Root Administrator
Thanks for the clear details :D

I changed the PHP handler for one of my versions to fcgi, and confirmed there is a domain using that version of PHP. I checked a PHP info page on that domain and it did list fcgi as the process:

Screen Shot 2021-01-14 at 10.52.09 AM.png

so I'm wondering if the handler isn't properly switching for that version of PHP since you're not even getting to that point.

In my WHM >> Apache Status page I see the numbers instantly increased for the CGI processes as I navigated the site.

Do you see any errors in the /etc/apache2/logs/error_log or /usr/local/cpanel/logs/error_log files when you make the switch to the fcgi handler in WHM? It seems like that is the most likely spot where there is a failure. If not, it might be best to submit a ticket so we can do some testing directly on that machine.
 

Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
n my WHM >> Apache Status page I see the numbers instantly increased for the CGI processes as I navigated the site.
No. Always ZERO process. Then Server API like your only shows CGI/1.1...

AH00489: Apache/2.4.46 (cPanel) OpenSSL/1.1.1h mod_bwlimited/1.4 mod_fcgid/2.3.9 configured -- resuming normal operations

[Wed Dec 09 17:52:57.659525 2020] [mpm_event:notice] [pid 15479:tid 47239526519872] AH00489: Apache/2.4.46 (cPanel) OpenSSL/1.1.1h mod_bwlimited/1.4 mod_fcgid/2.3.9 configured -- resuming normal operations
[Wed Dec 09 17:52:57.659574 2020] [core:notice] [pid 15479:tid 47239526519872] AH00094: Command line: '/usr/sbin/httpd'
[Wed Dec 09 17:53:04.767434 2020] [proxy_fcgi:error] [pid 15574:tid 47239839979264] [client xx.xx.xx.xx:58370] AH01067: Failed to read FastCGI header
[Wed Dec 09 17:53:04.767472 2020] [proxy_fcgi:error] [pid 15574:tid 47239839979264] (104)Connection reset by peer: [client xx.xx.xx.xx:58370] AH01075: Error dispatching request to :
[Wed Dec 09 17:53:04.768239 2020] [proxy:error] [pid 15574:tid 47239839979264] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /opt/cpanel/ea-php74/root/usr/var/run/php-fpm/e31f88d129d69c880a9bb4bfdbc9cad2a2d59e4f.sock (*) failed
[Wed Dec 09 17:53:04.768258 2020] [proxy_fcgi:error] [pid 15574:tid 47239839979264] [client xx.xx.xx.xx:58370] AH01079: failed to make connection to backend: httpd-UDS
[Thu Dec 10 20:18:58.731349 2020] [proxy_fcgi:error] [pid 82100:tid 47239829473024] (70007)The timeout specified has expired: [client xx.xx.xx.xx:57233] AH01075: Error dispatching request to : (reading input brigade), referer: wipers
[Thu Dec 10 20:25:25.788309 2020] [proxy_fcgi:error] [pid 82100:tid 47239795853056] (70007)The timeout specified has expired: [client xx.xx.xx.xx:57242] AH01075: Error dispatching request to : (reading input brigade), referer: wipers

This is what I found in the logs (snip).
 
Last edited:

Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
In my hunting I found the listen string misconfigured... It's missing the address and port in the folder -
/opt/cpanel/ea-php74/root/etc/php-fpm.d

listen = /opt/cpanel/ea-php74/root/usr/var/run/php-fpm/xxxx.sock

So how do I figure out the listening port and address?

From PHP.net - Valid syntaxes are: 'ip.add.re.ss:port', 'port', '/path/to/unix/socket'.
 

Mopar1973Man

Member
Mar 9, 2018
18
0
1
New Meadows, Idaho
cPanel Access Level
Website Owner
Ok. after playing for a bit I managed to crash the site. So I was close to having it but no sure of the port and address. The Apache side need the info (port and address) and the PHP-FPM pool. There is for sure a disconnect between the two and not passing info.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,236
402
243
cPanel Access Level
Root Administrator
That's what I was getting at when I mentioned that something wasn't being configured properly. You shouldn't need to do anything with those files, or even know they exist, in order for things to just work.

For this issue it would be best to submit a ticket so we can see what's up and possibly prevent this in the future. If you do submit a ticket, please post the number here so I can follow along and keep the community updated as well.