How can I find the php.ini file used by the command line?

How to get a file's extension in PHP?
Download File to server from URL

If you need to enable pdo_mysql in the EasyPHP environment, follow the steps below.

Just run php --ini and look for Loaded Configuration File in the output for 
the location of php.ini used by your CLI.

solution 2

Unlike phpinfo() it will tell if it didn’t find/use a php.ini at all.

var_dump( get_cfg_var('cfg_file_path') );

And you can simply set the location of the php.ini. You’re using the command line version, so using the -c parameter you can specify the location for this particular run, e.g.

php -c /home/me/php.ini -f /home/me/test.php
How to get a file's extension in PHP?
Download File to server from URL

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top