Categories
Tips

Where is my php.ini file?

You’re running a PHP site and you just realized that the maximum upload size is a little bit small. You decided to increase the maximum upload size. But, you wonder yourself that: Where is my php.ini file – PHP config file?

Use phpinfo() to find php.ini file – PHP config file

I think this is a very common question for a newcomer with PHP. The easiest way to find out your php.ini file is to use phpinfo() function. The output result of phpinfo() function always contains the location of the current php.ini that is used.

Please have a look at an example below:

Example for output result of phpinfo() function

As you have seen above, at the highlighted row: Loaded Configuration File. This line will answer the question: Where is your php.ini file?

But please always remember that different websites may run different PHP versions. And each PHP version has its own php.ini. So, to make sure that you do the modification in the right configuration file, please create a PHP file that output phpinfo() beside your index.php.

And do not run this script in CLI mode (console, terminal…). Always view this script using a browser, in the same way as you browse your website. Because the PHP version in CLI may also differ from the PHP version that your website uses.

Conclusion

There will have many ways to find out where is your php.ini file. But, I think this is the simplest solution. If you found any bug or you have any better solutions, please feels free to drop a comment or write a message in GuestBook.

Leave a Reply

Your email address will not be published. Required fields are marked *