Home >Backend Development >PHP Tutorial >Where is My PHP CLI php.ini File Located?
Locating php.ini File for Command Line Usage
If you're experiencing issues with PHP extensions when using the command line interface (CLI), it's essential to edit the correct php.ini file. Typically, when modifying php.ini, users may navigate to the PHP configuration folder and apply changes to the file. However, this approach may not work for CLI usage.
To pinpoint the php.ini file used by the CLI, follow these simple steps:
1. Run php --ini in the Terminal or Command Window:
Execute the command php --ini to display a list of relevant information, including the location of the php.ini file used by the CLI.
2. Identify the "Loaded Configuration File":
Within the output generated by the php --ini command, look for the line that begins with "Loaded Configuration File". This line will specify the exact path to the php.ini file used by your CLI.
Once you have located the correct php.ini file, you can make the necessary changes and enable the desired PHP extensions. Remember to save and restart the CLI to apply your modifications.
The above is the detailed content of Where is My PHP CLI php.ini File Located?. For more information, please follow other related articles on the PHP Chinese website!