How do I know where php.ini is located?

If you need to make modifications to php.ini in your VPS, there are a couple of ways you can find out where it is located:

  1. In the command line, run the following command:
    php -i | grep php.ini

The following line will be displayed, containing the path of the php.ini file:
Loaded Configuration File => /usr/local/lib/php.ini

  1. you can create a php script with the following content:
    <?php phpinfo();

When you access this script from your browser, you will also see “Loaded Configuration File” containing the path of php.ini