Home > Backend Development > PHP Tutorial > Where is the PHP CLI php.ini File Located?

Where is the PHP CLI php.ini File Located?

Patricia Arquette
Release: 2024-12-13 03:24:09
Original
803 people have browsed it

Where is the PHP CLI php.ini File Located?

Locating the php.ini File for the Command Line

When enabling extensions in the PHP environment, it's essential to use the appropriate php.ini file. For command-line (CLI) operations, a different php.ini file is used than the one for the web server.

To locate the php.ini file used by the CLI, follow these steps:

1. Run the php --ini Command:

Open the command prompt or terminal and enter the following command:

php --ini
Copy after login

2. Identify the Configuration File Path:

In the output of the command, look for the line that begins with "Loaded Configuration File." This line indicates the path to the php.ini file used by the CLI.

For example, you might see output like the following:

...
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
...
Copy after login

This indicates that the php.ini file used by the CLI is located at /usr/local/etc/php/7.4/php.ini.

Example:

In the context of the given problem, you would need to locate the php.ini file used by the CLI and uncomment the line "extension=php_pdo_mysql.dll" in that file to enable the PDO MySQL extension.

The above is the detailed content of Where is the PHP CLI php.ini File Located?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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