1

I have currently 3 php.iniS files in my /etc/php5 path. tree:

./php5_
./php5_/cli
./php5_/cli/conf.d
./php5_/cli/php.ini
./php5_/apache2
./php5_/apache2/conf.d
./php5_/apache2/php.ini
./php5_/conf.d
./php5_/conf.d/suhosin.ini
./php5_/conf.d/mysql.ini
./php5_/conf.d/mysqli.ini
./php5_/conf.d/gd.ini
./php5_/conf.d/pdo.ini
./php5_/conf.d/mcrypt.ini
./php5_/conf.d/curl.ini
./php5_/conf.d/pdo_mysql.ini
./cli
./cli/conf.d
./cli/php.ini
./apache2
./apache2/conf.d
./apache2/php.ini
./conf.d
./conf.d/memcache.ini
./conf.d/suhosin.ini
./conf.d/mysql.ini
./conf.d/mysqli.ini
./conf.d/gd.ini
./conf.d/pdo.ini
./conf.d/mcrypt.ini
./conf.d/memcached.ini
./conf.d/curl.ini
./conf.d/pdo_mysql.ini

but I still feel that there is something wrong. I tried to make some syntax errors in all php.ini files, tried to restart apache and it restarted successfully. What's wrong? How do I get path to REAL php.ini I should edit to be able to see changes?

3 Answers 3

6

For the web, create a simple php page that has the following

    <?php
    phpinfo();
    ?>

It will show all the ini files parsed

6

From your command line, just run php --ini:

[sandro@mercury ~]$ php --ini
Configuration File (php.ini) Path: /usr/local/etc
Loaded Configuration File:         /usr/local/etc/php.ini
Scan for additional .ini files in: /usr/local/etc/php
Additional .ini files parsed:      /usr/local/etc/php/extensions.ini
2
  • 1
    and when I use cli, does it apply to browser (apache) access, too ?
    – genesis
    Jul 27, 2011 at 13:49
  • 1
    Unless you've managed to setup multiple php's on the same server running your apache server, yes. I actually had to setup a server using php4 and php5 years ago, and it's a glorious pain. You'd have run into this question far sooner if you had such a setup ;) edit: sreimer's answer is probably best to know for certain what the server's referencing as far as your php install is concerned
    – sandroid
    Jul 27, 2011 at 14:00
2

You can check it with:

# php -i | grep "php.ini"

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.