Two ways to find the path to the php configuration file php.ini

  • 2021-06-28 11:51:22
  • OfStack

Usually the location of php.ini is:

/etc Under directory or /usr/local/lib Directory. 

If you still can't find php.ini or if the modification to php.ini doesn't take effect (it's not the right one), use the following method:

1. Create a new php file and write the following code

echo phpinfo();
 Then visit the page in the browser and search php.ini , 
2. Execute, ( Needs modification php For your own path )
[code]/usr/local/php/bin/php --ini

It shows the path where php.ini is located and under which path there is no php.ini file.
Configuration File (php.ini) Path: /usr/local/php/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

The location of php.ini is modified as follows: The php.ini file is placed by default on/usr/local/lib,

The -- with-config-file-path parameter can be used at compile time to modify the storage location of php.ini.

For example,
You can use--with-config-file-path=/etc
Store php.ini under/etc and copy php.ini-dist to/etc/php.ini from the source package.

Related articles: