Find ‘php.ini’ – PHP Configuration File Location

The php.ini file is the default configuration file for PHP, that provides a lot of configuration directives that allow you to modify various behaviors of PHP.

To change PHP settings you need to edit the php.ini file, but firstly you should locate it.

In this short note i will show the easiest method of how to find the php.ini file from the command line.

Locate php.ini

To find the location of the php.ini file, simply execute the following command:

$ php --ini
- sample output -
Configuration File (php.ini) Path: /etc/php/7.4/cli
Loaded Configuration File:         /etc/php/7.4/cli/php.ini
Scan for additional .ini files in: /etc/php/7.4/cli/conf.d
Additional .ini files parsed:      /etc/php/7.4/cli/conf.d/10-opcache.ini,

The command above returns the location of the php.ini file.

Was it useful? Share this post with the world!

Leave a Reply