jasperthedummy

Registered
Nov 13, 2016
3
0
1
SIngapore
cPanel Access Level
Root Administrator
Hi there,

I am wondering if there is a way for me to access the PHP-FPM status page of any particular PHP-FPM pool within the WHM interface just like how we can access the Apache Status page as easily within WHM?

I notice that pm.status_path is currently pointing to /status in all my config files of all my pools. /opt/cpanel/ea-php54/root/etc/php-fpm.d/[domain].conf :
Code:
pm.status_path = /status
Allowing for this will enable me to easily monitor the usage of all my pools:
Code:
pool:                 www
process manager:      dynamic
start time:           17/May/2016:13:54:02 +0530
start since:          886617
accepted conn:        1619617
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       28
active processes:     2
total processes:      30
max active processes: 31
max children reached: 0
slow requests:        0
An added bonus will be if the page can show with the /status?full option to allow me to view more details on the processes within the pool.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Hello,

There's no feature in WHM to show the PHP-FPM status page at this time. I encourage you to submit a feature request to allow for that functionality via:

Submit A Feature Request

Thanks!
 

dhultin

Registered
Feb 22, 2015
3
1
3
cPanel Access Level
DataCenter Provider
I was messing around with this today and this is a pretty simple thing to do. I added this to my domains configuration in httpd.conf with Easy Apache4. You could likely make an include file for this instead. The proxy_fcgi_module section already exists. I added <LocationMatch>

<IfModule proxy_fcgi_module>
<FilesMatch \.(phtml|php[0-9]*)$>
SetHandler proxy:unix:/opt/cpanel/ea-php56/root/usr/var/run/php-fpm/c71e80857422fac3e2c4db73c2eb615bedb15678.sock|fcgi://disc4life.com/
</FilesMatch>
<LocationMatch "/(ping|status)">
order deny,allow
deny from all
#allow from 10.20.4.4
allow from 10.20.4.0/22
SetHandler proxy:unix:/opt/cpanel/ea-php56/root/usr/var/run/php-fpm/c71e80857422fac3e2c4db73c2eb615bedb15678.sock|fcgi://disc4life.com/
</LocationMatch>
</IfModule>

Now I can visit /status and /status?full or /ping on my domain and it shows the FPM status for my domain. Rules are here to deny / allow access as well based on IP. Good luck.
 
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463

Alesak

Registered
Oct 5, 2018
1
3
3
Sydney
cPanel Access Level
Root Administrator
There is pretty easy way to achieve this without much configuration:
  1. add or change status path to end with .phtml like, you may add pm_status_path: /status.phtml to /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
  2. than rebuild FPM configuration files with /scripts/php_fpm_config --rebuild
  3. than create file status.phtml in each website root with simple content like <html></html> ,file must exist so the request is forwarded to FPM
  4. to finish just restart PHP-FPM daemons
Now you will be able to see status page like http://example/status.phtml
 

speckados

Well-Known Member
Hi.

I've tried this on my machines and not work.
I think I made a mistake in the process.

vi /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

Code:
---
php_admin_flag_allow_url_fopen: 'on'
php_admin_flag_log_errors: 'on'
php_admin_value_disable_functions: "\"\""
php_admin_value_doc_root: "\"[% documentroot %]/\""
php_admin_value_error_log: "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
php_admin_value_short_open_tag: 'on'
php_value_error_reporting: E_ALL & ~E_NOTICE
pm_max_children: 5
pm_max_requests: 20
pm_process_idle_timeout: 10
pm_status_path = "/status.phtml"
ping_path = "/ping"
/scripts/php_fpm_config --rebuild
Code:
....
info [php_fpm_config] rebuild_files: working on domain (arch.domain.com)
info [php_fpm_config] rebuild_files: working on domain (test.domain.com)
info [php_fpm_config] php-fpm: rebuild_files: restart fpm services for Apache
info [php_fpm_config] php-fpm: fpm services restarted
info [php_fpm_config] Rebuilding vhosts in apache conf
info [php_fpm_config] Rebuild Complete
[ICODE]

Check changes fails
cat /opt/cpanel/ea-php72/root/etc/php-fpm.d/domain.com.conf
[CODE]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; cPanel FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; NOTICE This file is generated. Please use our WHM User Interface
; to set these values.

[domain_com]
catch_workers_output = yes
chdir = /home/domain
group = "domain"
listen = /opt/cpanel/ea-php72/root/usr/var/run/php-fpm/e519794b34f5a594b0441b0b59a73fd7cca77e21.sock
listen.group = "nobody"
listen.mode = 0660
listen.owner = "domain"
php_admin_flag[allow_url_fopen] = on
php_admin_flag[log_errors] = on
php_admin_value[doc_root] = "/home/domain/public_html/"
php_admin_value[error_log] = /home/domain/logs/domain_com.php.error.log
php_admin_value[short_open_tag] = on
php_value[disable_functions] = ""
php_value[error_reporting] = E_ALL & ~E_NOTICE
ping.path = /ping
pm = ondemand
pm.max_children = 100
pm.max_requests = 750
pm.max_spare_servers = 5
pm.min_spare_servers = 1
pm.process_idle_timeout = 150
pm.start_servers = 0
pm.status_path = /status
security.limit_extensions = .phtml .php .php3 .php4 .php5 .php6 .php7 .php8
user = "domain"
pm.status_path show /path instead /status.pthml

After restart php-fpm, get 404 for

https://domain.com/status or https://domain.com/ping

Also if create a status.phtml
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,360
1,632
363
cPanel Access Level
Root Administrator
@speckados - it's important to note the details provided so far aren't official workarounds provided by cPanel, so I can't say for sure if they work across version changes and updates to our software.

It might be best to open a ticket with our Technical Support team to see if there are other options available to get this configured.