How to Get php.ini File Path in Ubuntu?

By Hardik Savani April 12, 2023 Category : Ubuntu

Hey Folks,

Now, let's see an example of get php.ini path. In this article, we will implement a get php ini location. This article goes in detailed on php ini location ubuntu. This example will help you php ini file path in ubuntu.

I will show you the following three ways to find php.ini file path in Ubuntu. so let's see the one-by-one example code:

Example 1:

1. Open a terminal window by pressing Ctrl+Alt+T on your keyboard.

2. Run the following command to find the location of the php.ini file:

php -i | grep 'Loaded Configuration File'

3. This will display the path to the php.ini file. It will look something like this:

Loaded Configuration File => /etc/php/8.1/cli/php.ini

In this example, the php.ini file is located at /etc/php/8.1/cli/php.ini. Note that the exact path may be different on your system depending on your PHP version and installation.

Example 2:

Create a PHP file with the following code:




Save the file and open it in your web browser. This will display a lot of information about your PHP configuration. Look for the "Loaded Configuration File" row, which will show the path of the php.ini file.

Example 3:

you can also check common locations for the php.ini file in Ubuntu by running the following command:

sudo find / -type f -name "php.ini"

This command will search for the php.ini file starting from the root directory (/) and display the path to any files named php.ini that it finds.

I hope it can help you...

Tags :