parent root
PHP: php_ini_loaded_file - Manual
PHP 7.2.23 Release Announcement

php_ini_loaded_file

(PHP 5 >= 5.2.4, PHP 7)

php_ini_loaded_fileRetrieve a path to the loaded php.ini file

Description

php_ini_loaded_file ( void ) : string

Check if a php.ini file is loaded, and retrieve its path.

Parameters

This function has no parameters.

Return Values

The loaded php.ini path, or FALSE if one is not loaded.

Examples

Example #1 php_ini_loaded_file() example

<?php
$inipath 
php_ini_loaded_file();

if (
$inipath) {
    echo 
'Loaded php.ini: ' $inipath;
} else {
    echo 
'A php.ini file is not loaded';
}
?>

The above example will output something similar to:

Loaded php.ini: /usr/local/php/php.ini

See Also

add a noteadd a note

User Contributed Notes 3 notes

up
8
Andy Dodd
4 years ago
Or you could use
php -i | grep php.ini
up
2
yc
3 years ago
you can also do:

php -i | grep "Configuration File"
up
-2
litelus
4 years ago
quick way to find the ini loaded for the cli
php -r "echo php_ini_loaded_file();"
To Top
parent root