Home>Article>Backend Development> How to get php.ini file path?
We can use thephp_ini_loaded_file()function in PHP to get the location path of the php.ini file.
Sometimes we need to get the php.ini file path. Then if you need to get the path to the php configuration file, you can do the following:
The PHP code example is as follows:
print_r(php_ini_loaded_file());
Output:
D:\wamp\bin\apache\apache2.4.17\bin\php.ini
As shown above, We successfully obtained the path of the local php.ini file, namely D:\wamp\bin\apache\apache2.4.17\bin\php.ini.
Function introduction:
php_ini_loaded_file() functionGet the path of the loaded php.ini file
Syntax:
php_ini_loaded_file ( void ) : string
Check if there is a loaded php.ini file and get its path.
This function has no parameters. Returns the path to the loaded php.ini, or FALSE if none.
Related recommendations: "PHP Tutorial"
This article is about the method of obtaining the php.ini file path. It is very simple. I hope it will be useful to friends who need it. help!
The above is the detailed content of How to get php.ini file path?. For more information, please follow other related articles on the PHP Chinese website!