Where is php.ini

By | 6 November, 2013

If you are configuring some remote strange not safe for work server and you have the urge to edit the php.ini – assuming you have permissions to do it – you can find out where the file is like this:

read on.

On the command line type:

$ php --ini

You will get something like this:

$
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/curl.ini,
/etc/php.d/dom.ini,
/etc/php.d/fileinfo.ini,
/etc/php.d/json.ini,
/etc/php.d/mysql.ini,
...

That first line tells you the path of where the file is. Well, the second line is the direct path. So navigate to it and vim away.

You can also find the location of the file by using php_info() and looking at the result; or greping the result, or asking someone. A world of possibilities.