Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I found this page: 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)

share|improve this question
why the downvotes ? – user56379 Feb 1 '13 at 21:46

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
so it will look directly for /etc/php.ini ? – user56379 Feb 1 '13 at 21:51
Most likely. It is a compile time option. strings | grep \/etc/ will give you hints about the basedir where it expects to find php.ini in. – adamo Feb 1 '13 at 22:04
found it, perfect – user56379 Feb 1 '13 at 22:06

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.

share|improve this answer

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

<Install Dir of PHP>/bin/php -i | grep apxs

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

#php -i | grep apxs 

Failed loading cannot open shared object file: No    such file or directory PHP Warning:  PHP Startup: Unable to load dynamic library     '<PHP_HOME>/lib/php/extensions/debug-non-zts-20121212/' - <PHP_HOME>/lib/php/extensions/debug-non-zts-20121212/ undefined symbol: OnUpdateLongGEZero in Unknown on line 0

So in this way i was able to figure out the php used by Apache. APACHE_HOME/modules/ directory has all the modules, was already present in APACHE_HOME/modules/.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.