PHP Configurations
There are multiple versions of php.ini
used depending on the sever configurations.
php.ini
is located in several different directories of an active PHP version. The correct one to use depends on the sever configurations and use case.
Find the active PHP directory
Search for the current PHP directory:
php -i | grep "Loaded Configuration File"
This will return something like:
Loaded Configuration File => /etc/php7.2/cli/php.ini
In this example the current active PHP install is running in /etc/php7.2
.
Config Files
CLI php.ini
For the CLI PHP program. Changes to this config file will only affect PHP as it runs in the terminal – it will NOT affect the web server.
/etc/php/7.2/cli/php.ini
Apache php.ini
For the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.
/etc/php/7.2/apache2/php.ini
Nginx or FPM php.ini
A fastcgi-compatible ‘wrapper’ for PHP processing. This is the one you need to edit if you’re using the Nginx web server or Apache with PHP-FPM.
/etc/php/7.2/fpm/php.ini