Jump to content

.../bin/php-cgi => how to "digg" deeper and understand what's happening in those process ?


Recommended Posts

CONTEXT : I have many php scripts executing live...

WHAT I DO :

pgrep -ia php

(to get details of the process containing php...) option -ia show the command...

WHAT I GET :

112233 /opt/cpanel/ea-php80/root/usr/bin/php-cgi
223355 /opt/cpanel/ea-php80/root/usr/bin/php /home/..some.php

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} :

pidstat -p 112233
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} :

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} :

lsof -p 1234277
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 user mem REG 252,1 315112 578898832 /opt/cpanel/ea-php80/root/usr/lib64/php/modules/mailparse.so 
php-cgi 1234277 user mem

 

Edited by Jintor
Link to comment
Share on other sites

digging on the web I found this

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....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.