I found this page: http://www.php.net/manual/en/configuration.file.php. On my OS: Fedora 17, Apache 2.2,PHP 5.4 I searched for PHPIniDir in the httpd.conf file. This configuration does not exists.
How does Apache knows where is the php.ini then ? ( /etc/php.ini)
Compile time defaults exist as a fail-safe when certain directives are not specified. In this case the PHP module "knows" where to look for php.ini if no directive is found because it is programmed and compiled in such a way.
It is php that actually knows where the the php.ini file. This information is most likely incorporated into the PHP Apache module which either is generated by the PHP release or the PHP package is used during apache compilation.
I had a Apache and PHP installed on one of the server. This was installed by the previous sys admin. Both the Apache and PHP was complied from the source. In addition to this there was a default PHP installed. So to know which PHP is used by the Apache. I run the below command
This gave me the path to apache apxs
This gave me info on which Apache is being used by this php. This path and the apache currently running were the same. The default php gave error when i typed
So in this way i was able to figure out the php used by Apache.
APACHE_HOME/modules/
directory has all the modules,libphp5.so
was already present inAPACHE_HOME/modules/
.