Home > Backend Development > PHP Tutorial > How Can I Locate the Active \'php.ini\' File?

How Can I Locate the Active \'php.ini\' File?

Barbara Streisand
Release: 2024-10-24 11:33:29
Original
597 people have browsed it

How Can I Locate the Active 'php.ini' File?

Finding the Location of the Active 'php.ini' File

When multiple 'php.ini' files are present on a system, it's essential to determine which one is currently in use. This is crucial for ensuring that PHP settings are correctly applied to your web applications.

One reliable method to locate the active 'php.ini' file is through the command line:

<code class="bash">php --ini</code>
Copy after login

This command will display information about the 'php.ini' file being used, including its path and various configuration details.

For PHP scripts executed through web server SAPIs (such as Apache or Nginx), you can utilize the 'phpinfo()' function to obtain information about the active 'php.ini' file.

<code class="php"><?php
phpinfo();
?></code>
Copy after login

Sample output:

Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File:         /usr/local/php5/lib/php.ini
Scan for additional .ini files in: /usr/local/php5/php.d
Additional .ini files parsed:      /usr/local/php5/php.d/10-extension_dir.ini,
/usr/local/php5/php.d/20-extension-opcache.ini,
/usr/local/php5/php.d/40-openssl.ini,
/usr/local/php5/php.d/50-extension-apcu.ini,
/usr/local/php5/php.d/50-extension-curl.ini,
/usr/local/php5/php.d/50-extension-gmp.ini,
/usr/local/php5/php.d/50-extension-imap.ini,
/usr/local/php5/php.d/50-extension-intl.ini,
/usr/local/php5/php.d/50-extension-mcrypt.ini,
/usr/local/php5/php.d/50-extension-mssql.ini,
/usr/local/php5/php.d/50-extension-pdo_pgsql.ini,
/usr/local/php5/php.d/50-extension-pgsql.ini,
/usr/local/php5/php.d/50-extension-propro.ini,
/usr/local/php5/php.d/50-extension-raphf.ini,
/usr/local/php5/php.d/50-extension-readline.ini,
/usr/local/php5/php.d/50-extension-xdebug.ini,
/usr/local/php5/php.d/50-extension-xsl.ini,
/usr/local/php5/php.d/60-extension-pecl_http.ini,
/usr/local/php5/php.d/99-liip-developer.ini
Copy after login

By using these methods, you can effectively identify the 'php.ini' file being utilized by your PHP scripts and ensure that appropriate configuration settings are in place.

The above is the detailed content of How Can I Locate the Active \'php.ini\' File?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template