Finding php.ini in Linux

When PHP starts, it reads the setup file php.ini, which contains directives about the use of PHP. Depending on under which mode PHP is working under (CGI, FastCGI, Apache, etc) the setup file is only read when the server is started or in each execution. Knowing which mode PHP is working in is important, because it will help you know which php.ini file is being read, and therefore which one you will have to do the changes in that you want to make.


Remember that the changes that you make in the php.ini file will affect all the domains setup on the server.

The fastest way to find on which route php.ini is on, is t use the “locate” command, but since as already said, there usually are several php.ini files inside one server, therefore this option is only useful to remember the route of the file if we knew already knew it. Anyway, the command to do the search would be:


In a Linux Server with Plesk where support for PHP is used as a module to Apache, the absolute route of the file would be:


locate php.ini

It is sometimes necessary to update the locate data base in order for it to take the server files into account. In order to do it, execute the following command:


Another way to find the php.ini file would be using the PHPInfo() function of PHP to locate where the php.ini setup is being read.

You can find more information about the use of PHPInfo() on the post. See the PHP version.

To write a comment on this article, fill out the form below. Fields marked with an asterisk (*) are required.