PHP Terms php.ini Find which php.ini is used

 

- Info:

- This tutorial shows how to determine which php.ini is used.

- Be aware that php.ini settings are overriden by .ini files in subdirectories like conf.d or ext.d

 

- Command Line - Unix:

- On UNIX you can use following command to see which php.ini is used when PHP is called from command line:

- php -i | grep 'Configuration File'

Configuration File (php.ini) Path => /etc/php5/cli

Loaded Configuration File => /etc/php5/cli/php.ini

 

- Command Line - Windows/Unix:

- Since Windows doesn't support grep on both Windows and Unix you can use just:

- php -i

phpinfo()

PHP Version => 5.3.6-13ubuntu3.1

System => Linux givor 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64

Build Date => Aug 29 2011 23:37:08

Server API => Command Line Interface

Virtual Directory Support => disabled

Configuration File (php.ini) Path => /etc/php5/cli

Loaded Configuration File => /etc/php5/cli/php.ini

Scan this dir for additional .ini files => /etc/php5/cli/conf.d

Additional .ini files parsed => /etc/php5/cli/conf.d/pdo.ini,

/etc/php5/cli/conf.d/pdo_sqlite.ini,

/etc/php5/cli/conf.d/sqlite.ini,

/etc/php5/cli/conf.d/sqlite3.ini

- Since output might be bigger then the number of lines terminal can show you should increase number of lines.

- On UBUNTU do this: Terminal Edit Profile Preferences Scrolling Unlimited: CHECK Close

- On Windows do this:

- This will also show additional .ini files which override settings in php.ini

 

- Web:

- Create text.php and put it on web server so that you could call it using web browser.

 

test.php

<?php phpinfo(); ?>