That depends on the SAPI which is used by your webserver to comunicate with php.
That CAN be libapache2-mod-php but it can just as easily be php-fpm.
You did not provide any information about your operating system. This is for Ubuntu/Debian like OSes:
The most important sapis are:
Command Line Interface
cli
package: php<VER>-cli
description:
cli is used by php scripts invoked from the command line. i.e. all processes
that were explicitly NOT called by the web server (cron jobs, occ commands,
etc.)
Apache2 module
apache2
package: libapache2-mod-php<VER>
description:
the apache2 module is the default sapi for apache2. The downside is that it’s
not particularly scalable and doesn’t support http2.
libapache2-mod-php relies on the old but stable Multi-Processing Module (MPM)
“mpm-prefork”.
Fast Process Manager
fpm
package: php<VER>-fpm
description:
this is the default sapi used by nginx. On apache2 php-fpm relies on the more
scalable threaded MPM “mpm-event”. Additionally it needs the apache2-modules
“proxy_fcgi” and “setenvif”.
Every sapi has its own php.ini file:
/etc/php/<VER>/<SAPI>/php.ini
If your webserver is apache2, you can find out the active mpm (Multi Processing
Module) with this command call:
as explained above, the “mpm_event_module” means that apache2 speaks via fpm,
while the “mpm_prefork_module” indicates that the apache2 module is used for the
comunication between webserver and php.
The sapi used by apache 2 can also be found out with this command call: