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")
CONTEXT : I have many php scripts executing live...
WHAT I DO :
(to get details of the process containing php...) option -ia show the command... WHAT I GET : [CODE=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} : [CODE=bash]pidstat -p 112233
it says this [CODE=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} :
WHAT I TRIED {3} : [CODE=bash]lsof -p 1234277
pgrep -ia php(to get details of the process containing php...) option -ia show the command... WHAT I GET : [CODE=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} : [CODE=bash]pidstat -p 112233
it says this [CODE=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} :
pstree -aps 112233
systemd,1 --switched-root --system --deserialize 17
??httpd,3515834 -k start
??httpd,1233812 -k start
??php-cgi,112233WHAT I TRIED {3} : [CODE=bash]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 stubfeed mem REG 252,1 315112 578898832 /opt/cpanel/ea-php80/root/usr/lib64/php/modules/mailparse.so
php-cgi 1234277 stubfeed mem -
I found this [CODE=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....0 -
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. 0 -
@andrew.n - if I'm reading his question correctly, I think he's referring to the ones that don't list a "something.php" file after the /opt/cpanel..... command. If that is correct, your #2 investigation is the answer - your just seeing the parent PHP process waiting for a connection. 0
Please sign in to leave a comment.
Comments
3 comments