Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

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

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_INI_SCAN_DIR=/usr/local/lib/php/custom

=> # 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?)

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

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.

ANSWERS ON SOME OF YOUR THOUGHTS:

  • 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.

Finally

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

Thanks in advance.

share|improve this question
    
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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.