Let's talk about how PHP newbies can find and obtain the php.ini path

藏色散人
Release: 2023-04-11 10:48:01
forward
3584 people have browsed it

This article brings you relevant knowledge about php. It mainly talks about how to find the path of the PHP configuration file php.ini. Friends who are interested can take a look below. I hope it will be helpful to everyone. .

Let's talk about how PHP newbies can find and obtain the php.ini path

How to find and obtain the path of the PHP configuration file php.ini

Purpose: View the current PHP opening Which extension modules are installed

Stupid method

Create a new directory, create an index.php file in it, and write the following code:

Copy after login

After saving , and then use PHP to open a temporary access web port:

php -S localhost:2233
Copy after login

Use a browser to access localhost:2233 to see the configuration.

Recommended method

php -m
Copy after login

This command can see the currently installed extension modules, it is fast and intuitive:

$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
FFI
....
Copy after login

How to find the path to php.ini

You can use the stupid method above, View the php.ini file path directly on the page, but a stupid method is always a stupid method.

Recommended to use

php --ini
Copy after login

Effect:

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/8.1
Loaded Configuration File:         /usr/local/etc/php/8.1/php.ini
Scan for additional .ini files in: /usr/local/etc/php/8.1/conf.d
Additional .ini files parsed:      /usr/local/etc/php/8.1/conf.d/ext-opcache.ini
Copy after login

In this way, you can know its path /usr/local/etc/php/8.1/php.ini

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Let's talk about how PHP newbies can find and obtain the php.ini path. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!