Where is my PHP.ini? How to find PHP configuration file

This post shows how to find the php.ini configuration file on your server.

In this tutorial, I will help you to find your PHP.ini file on your server.

There are several methods to do this. In this tutorial I will show you two methods. In most cases php.ini is located in /etc/php.ini.

Locate PHP.ini using command line interface (terminal)

  1. Connect to your server with ssh (tutorial here).
  2. Run:
    php -i | grep “Loaded Configuration File”
And it will show you something like this:
Loaded Configuration File => /etc/php.ini.

Locate php.ini using a simple php file

  1. Create a public php file on your server (ex: info.php) and add this line in the file:
    <?php phpinfo(); ?>
  2. Open this file in your browser and you can see the php.ini location on the line containing: Loaded Configuration File.

If you need a reliable Dedicated Server or VPS, you should definitely try InterServer Hosting. You can test InterServer for 1 Penny, for the first month, using this coupon code: WSG1PENNY.