Home >Backend Development >PHP Tutorial >How to get php.ini file path?

How to get php.ini file path?

藏色散人
藏色散人Original
2019-03-13 15:54:363530browse

We can use the php_ini_loaded_file() function in PHP to get the location path of the php.ini file.

How to get php.ini file path?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn