How to get files of function that php is executing (when I pgrep -ia php some is only "/opt/cpanel/ea-php80/root/usr/bin/php-cgi")

Operating System & Version
almalinux 8.4
cPanel & WHM Version
100

Jintor

Member
Jul 14, 2021
10
0
1
Canada
cPanel Access Level
Root Administrator
CONTEXT : I have many php scripts executing live...

WHAT I DO :
Code:
pgrep -ia php
(to get details of the process containing php...) option -ia show the command...

WHAT I GET :
Bash:
112233 /opt/cpanel/ea-php80/root/usr/bin/php /home/stubfeed/public_html/templates/cron/scan/cron_central_sheraday.php cvpsMaster
223355 /opt/cpanel/ea-php80/root/usr/bin/php-cgi
QUESTION :
The php processes that shows the executing file are ..../bin/php
The php processes that don't show the command have ..../bin/php-cgi `/opt/cpanel/ea-php80/root/usr/bin/php-cgi` => How can I digg deeper to understand what php is doing in those processes ? they run for long time, can I kill them without causing problems ? what is they comes back, how can I pinpoint if there is a bad line of code executing ?? (note : I checked error_log file => no error are being reported) but thoses php-cgi tends to come back.... why ?

WHAT I TRIED {1} :
Bash:
pidstat -p 112233
it says this
Bash:
Linux 4.18.0-305.19.1.el8_4.x86_64 (host.example.com)     2021-10-14     _x86_64_    (8 CPU)

05:08:53 PM   UID       PID    %usr %system  %guest   %wait    %CPU   CPU  Command
05:08:53 PM  1001   1234277    0.00    0.00    0.00    0.00    0.00     6  php-cgi
WHAT I TRIED {2} :
Code:
pstree -aps 112233
systemd,1 --switched-root --system --deserialize 17
  └─httpd,3515834 -k start
      └─httpd,1233812 -k start
          └─php-cgi,112233
WHAT I TRIED {3} :
Bash:
lsof -p 1234277
Code:
COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF      NODE NAME
php-cgi 1234277 stubfeed  cwd    DIR  252,1       32  62973745 /home/user/public_html/....
php-cgi 1234277 stubfeed  rtd    DIR  252,1     4096       128 /
php-cgi 1234277 stubfeed  txt    REG  252,1  6387136 138429576 /opt/cpanel/ea-php80/root/usr/bin/php-cgi
php-cgi 1234277 stubfeed  DEL    REG    0,1          110106200 /dev/zero
php-cgi 1234277 stubfeed  mem    REG  252,1   315112 578898832 /opt/cpanel/ea-php80/root/usr/lib64/php/modules/mailparse.so
php-cgi 1234277 stubfeed  mem
 
Last edited:

Jintor

Member
Jul 14, 2021
10
0
1
Canada
cPanel Access Level
Root Administrator
I found this

Bash:
ps eax |grep php |grep -v grep|awk '{print $1 $8 $15 $19}'
it shows PID - REDIRECT_SCRIPT_URL= ..... usefull stuff to know at least what php "could" have a bad infinite loop on the code....
 

andrew.n

Well-Known Member
Jun 9, 2020
676
209
43
EU
cPanel Access Level
Root Administrator
You simply look into the content of the file (/home/stubfeed/public_html/templates/cron/scan/cron_central_sheraday.php) and review the code to understand what does it do exactly. You might need a developer to assist you with this though if you don't know PHP language.