PHP configuration files are not located in the same place in all operating systems variants. Therefore for you to know where your specific configuration is located, we have provided this little guide featuring the major operating systems and distros.
First off you can run php -i
from the command-line on Windows or terminal on Unix systems. This will display a lot of information about your particular setup. Next, you need to look for the value of the Loaded Configuration File
.
Here is a quick example of Unix-based systems.
$ php -i | grep 'Loaded Configuration File'
Loaded Configuration File => /etc/php.ini
Here are the general locations of the php.ini
PHP configuration files.
macOS
/private/etc/php.ini
RedHat/CentOS/Fedora
/etc/php.ini
Ubuntu < 16.10
/etc/php5/{cli,apache2,cgi}/php.ini
Ubuntu >= 16.10
/etc/php7/{cli,apache2,cgi}/php.ini
Ubuntu >= 18.04
/etc/php/{php_version}/{cli,apache2,cgi}/php.ini
xampp
{installation directory}/php/php.ini
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.