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. .
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
Use a browser to access localhost:2233 to see the configuration.
Recommended method
php -m
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 ....
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
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
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!