PHP 8.3.0 RC 6 available for testing

php_ini_loaded_file

(PHP 5 >= 5.2.4, PHP 7, PHP 8)

php_ini_loaded_file取得已加载的 php.ini 文件的路径

说明

php_ini_loaded_file(): string|false

检查是否有加载的 php.ini 文件,并取回它的路径。

参数

此函数没有参数。

返回值

已加载的 php.ini 路径,或在没有时返回 false

示例

示例 #1 php_ini_loaded_file() 示例

<?php
$inipath
= php_ini_loaded_file();

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

以上示例的输出类似于:

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

参见

add a note

User Contributed Notes 4 notes

up
0
geekcom
3 years ago
To find your php.ini just run

php --ini
up
0
Andy Dodd
8 years ago
Or you could use
php -i | grep php.ini
up
-1
yc
7 years ago
you can also do:

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