php_ini_scan_dir - How to find the php.ini file used by the command line?

php.ini settings (9)

I need to enable pdo_mysql in my EasyPhp environment, so I went to php.ini file and uncommented the following line:


Unfortunately I still have the same problem. I'm using the CLI so I suppose I need to locate the php.ini file used by the CLI. How can I find it?


find / -type f -name "php.ini" 

This will output all files named php.ini.

Find out which one you're using, usually apache2/php.ini

From what I remember when I used to use EasyPHP, the php.ini file is either in C:\Windows\ or C:\Windows\System32

If you want all the configuration files loaded, this is will tell you:

php -i | grep "\.ini"

Some systems load things from more than one ini file. On my ubuntu system, it looks like this:

$  php -i | grep "\.ini"
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/apc.ini,

In your php.ini file set your extension directory, e.g:

extension_dir = "C:/php/ext/"

You will see in you PHP folder there is an ext folder with all the dll's and extensions.

On OSX Mavericks, running:

$ php -i | grep 'Configuration File'


Configuration File (php.ini) Path => /etc
Loaded Configuration File:         (none)

In the /etc/ directory was:


(as well as php-fpm.conf.default)

I was able to copy php.ini.default to php.ini, add date.timezone = "US/Central" to the top (right below [php]), and the problem is solved.

(At least the error message is gone.)

Run php --ini in your terminal, you'll get all details about ini files

[[email protected] src]# php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/apc.ini,

For more, use helping command php --help It'll display all the possible options.

There is no php.ini used by the command line. You have to copy the file from ...EasyPHP-<<version>>\apache\php.ini to ...EasyPHP-<<version>>\php\php.ini than edit the one in php directory


  • https://.com/a/1961355/339872

You can get a full phpinfo() using :

php -i 

And, in there, there is the php.ini file used :

$ php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

On Windows use find instead:

php -i|find/i"configuration file"

php --ini

will give you all the details details on the uses path and possible ini file(s)