My phpinfo.php is not showing extra folder for additional PHP configuration files. I am running Apache v2.4.4(with PHP DSO) and PHP v5.4.14 on CentOS v6.3 32-bit. Apache and PHP installations are compiled from source.

I have not used the configure option '--with-config-file-scan-dir=PATH' for PHP. (And won't be using because I will be needing more than one folder).

Environment variable PHPRC and Apache Directive PHPIniDir are related to the main PHP file, which leaves me with the Environment variable 'PHP_INI_SCAN_DIR' to work with. Below are the steps what I did:-

STEP 1 of 2 - Settings for PHP

'PHP_INI_SCAN_DIR' being an OS Environment variable is required to be set before Apache starts. So I added the following entry to my /etc/profile.d/php.sh file.


Then rebooted the system.

Now the commands 'env | grep PHP', 'php -i | grep INI' and 'php --ini' gives me the following outputs.

=> # env | grep PHP


=> # php -i | grep INI

PHP_INI_SCAN_DIR => /usr/local/lib/php/custom
_SERVER["PHP_INI_SCAN_DIR"] => /usr/local/lib/php/custom

=> # php --ini

Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         /usr/local/lib/php.ini
Scan for additional .ini files in: /usr/local/lib/php/custom
Additional .ini files parsed:      (none)

STEP 2 of 2 - Settings for Apache

First Attempt


Added the following entry in both apache2/bin/envvars & apache2/bin/envvars-std files.

(Any comments on what is the difference between envvars & envvars-std file?)


Restarted Apache service. But the value for 'Scan this dir for additional .ini files' from phpinfo.php file shows empty.

Second Attempt


So I removed the entries from envvars & envvars-std. I have module mod_env loaded by default. I added the following in httpd.conf.

SetEnv PHP_INI_SCAN_DIR "/usr/local/lib/php/custom"

Restarted Apache service. Value for 'Scan this dir for additional .ini files' from phpinfo.php file still shows empty.

Third Attempt


Again, I removed the entries from httpd.conf. Added the same line to Directory section of my VirtualHost in httpd-vhosts.conf.

SetEnv PHP_INI_SCAN_DIR "/usr/local/lib/php/custom"

Restarted Apache service. Value for 'Scan this dir for additional .ini files' from phpinfo.php file still shows empty.


  • Yes, my phpinfo.php file is made of only phpinfo(). It is not a static file.

  • Yes, the browser cache was cleaned. I also tried another browser.


So, can anyone tell me why my phpinfo file is not showing the extra folder for additional PHP configuration files?

Thanks in advance.

  • The feature in question is both undocumented and kind of painful to get working correctly; the better option is to use the compile-time flag for setting this directory; failing that, try using symlinks to manage the configuration instead of changing the path. – TML Jun 27 '13 at 6:01

You have to start apache with that environment variable set. Setting the variable in /etc/profile.d/php.sh only sets it for the PHP executable itself, which is not used by mod_php5.

I just went through this rigamarole. Setting the variable with SetEnv won't work, either, as it's defined after mod_php5 is loaded.

In CentOS 6.5, I found that editing /etc/sysconfig/httpd allows you to set and export additional environment variables for the apache process itself. So try adding it there:

export PHP_INI_SCAN_DIR="/usr/local/lib/php/custom"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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