These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Determining IP number from php-cgi process on the new forum.
hello - last week eric was kind enough to explain that each php-cgi process is somebody accessing a website
https://www.virtualmin.com/node/35106
is there any way to determine an IP number for each php-cgi process running? i didnt see anything in the log files that would tie a logfile entry to a php-cgi process.
thank you very much.
Howdy,
You'd probably need to do that from within the application. PHP itself knows it's own process ID, as well as the IP address connected to it. But I don't know of a way to do that outside of the app.
Using netstat can give you a some insight there, but I'm not sure it's exactly what you're looking for. But if you run "netstat -anlp", you can see a list of all open connections, and what IP address is associated with them.
You can also use this command to get a list of every IP address connected to your server, sorted by how many open connections they have:
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
for the truly ignorant (like me) what he meant to say was:
that way newbies can translate from the terse CLI into something more friendly to read. I'm not sure it's exactly what you're looking for. the problem is once or twice a day i will have one website have a couple dozen php-cgi processes started up. its usually some overseas hacker. i have the firewall blocks in place (supposedly) but it does not seem to be foolproof. i have this set in my csf.conf file:
i also have httpd.conf MaxClients set lower on Eric's recommendation in httpd.conf and this seems to be helping: