How to find php.ini Location on Ubuntu 20.04
In this post, we will learn How to find php.ini Location on Ubuntu 20.04. In most cases, we find the php.ini file in the server but we did not find the php.ini file, so in this tutorial, how to find the location of the loaded php.ini. file. we check two ways to find php.ini file. first How to find the location of php.ini from the command line and How to find the location of php.ini by using the phpinfo() function.
Location of php.ini on Ubuntu 20.04
Find location of php.ini by using the phpinfo()
Create a file phpinfo.php within your web-server root directory eg. /var/www/html/
with the following content:
<?php #phpinfo.php // show all information phpinfo();
Find location of php.ini from command line
Find the location of php.ini from the command line execute the following command to locate the loaded php.ini configuration file for the command line PHP command:
php --ini | grep Loaded
Loaded Configuration File: /etc/php/7.3/cli/php.ini
Note: The above php.ini file location is used by the PHP command.
For the Apache web-server the above path will translate to:
/etc/php/7.3/apache2/php.ini
For Nginx or Apache with PHP-FPM:
/etc/php/7.3/fpm/php.ini