3 ways to find php.ini

PHP's 'php.ini' is a configuration file for PHP scripts on your server and it allows all kinds of things to be adjusted like memory usage or display settings but often you may forget where the file actually is (this can especially be the case if you're new to linux).

php default location

So here are a few ways that will help you find the default location of your php.in..

If you've installed PHP from a package manager like yum or apt-get, then you're in luck! It should always be located in '/etc/php/php.ini' and is probably the first place to look for if you're not sure where it actually is.

php -i

The config directory may vary between distributions so make sure to remember the path of php.ini file in your system while installing packages using rpm or deb files.

If you are not sure where it is then type php -i in your terminal which will show you the path of the configuration file in the output.


The last way to check, is using phpinfo(). Create a info.php page in the root directory of your website and use this code:

See https://www.php.net/manual/en/function.phpinfo.php

Simply enter the url to the page in your browser and see where it finds php.ini (usually near the top of the page).

whereis php

The last way that I have that did to make it on my list is to try running 'whereis php' or 'which php' this should give you a list of all the places on your system where php is mentioned.


I hope you find this guide helpful and in your server woes. If you are stuck on anything I did not mention in the article or have an even better way to troubleshoot don't be afraid to let me know!

Happy Coding 🙂

Leave a comment

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