# Php.ini location of Apache on Ubuntu

PHPUbuntu

As there are multiple versions of PHP with different sever configurations, php.ini could be located in several different folders.

You can use php function phpinfo() or linux command php -i | grep "Loaded Configuration File" to find out exactly which php.ini file your web sever is using .

In Linux, there are 3 locations which are common used. Take php 7.2 for example.

### Apache

/etc/php/7.2/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.

### CLI

/etc/php/7.2/cli/php.ini is 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.

### Nginx or Apache with PHP-FPM

/etc/php/7.2/fpm/php.ini is 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.

## Older Versions

For versions of Ubuntu lower than 16.04, /etc/php/5.6/,/etc/php/7.0/,/etc/php/7.1/, and so on, are replaced by /etc/php5/ and so on.