If you are trying to get the full path to the running Apache PHP module, do this.
The PHP file used by Apache should be named
libphp5.so. So you can run this
lsof command via
sudo lsof | grep libphp5.so
Which should return a whole pile of results with pretty much all of them showing the full path to
libphp5.so which should be something like this if you are on an Ubuntu/Debian system:
If you are trying to monitor your Apache server to figure out what file might be choking it, do this.
That said, it’s unclear to me from your question what you mean by “How to confirm which PHP file is running in Apache?” since rereading that makes me think that perhaps you are trying to figure out what PHP script is choking your server and not what PHP module Apache is loading? Because the actual PHP module Apache loads simple is just the PHP parser Apache uses. But a PHP script you are running via that setup is a whole different thing.
The problem is that the way Apache works is the contents/files are parsed on demand. So you need to run a tool that will monitor Apache requests in real time to get the info you are looking for in that case. There are a few ways you can do this from the command line.
Using Apache Top to monitor an Apache web server.
First, you can install and run Apache Top which is similar to the standard Linux/Unix
top but for Apache processes. For example, here is a nice/simple way to monitor a web server’s log files in realtime with Apache Top:
apachetop -r 2 -f /var/log/apache2/access.log
-r 2 will refresh the output every 2 seconds and the
-f /var/log/apache2/access.log tells
apache-top to report on info from the provided Apache log. In that example it’s loading the default Apache log file from an Ubuntu/Debian setup, but you should change that full file path to match your actual Apache log file location.
Using ELinks to monitor an Apache web server.
Another method I use to monitor Apache on a server is using ELinks and the default Apache status URL like this:
ELinks is basically just a text-based web browser. So if you run that from the command line, it will just load the URL passed to it and if you notice that URL includes the
refresh=1 parameter which basically just tells the
server-status to refresh itself every second.