Home >Backend Development >PHP Tutorial >How to check the path of the php configuration file php.ini? _PHP Tutorial
Tell you two ways to find the path of the php configuration file php.ini.
Usually the location of php.ini is:
/etc directory or /usr/local/lib directory.
If you still cannot find php.ini or if you find php.ini and the modification does not take effect (in fact, you did not find it correctly), please use the following method:
1. Create a new php file and write the following code
<?<span>php </span><span>echo</span> <span>phpinfo</span>();
Then visit the page in the browser and search for php.ini. The environment variable results in the phpinfo function are used.
2. Execute, (you need to modify php to your own path)
/usr/local/php/bin/php --ini
The path where php.ini is located will be displayed. Which path does not contain the php.ini file?
Configuration <span>File</span> (php.ini) Path: /usr/local/php/<span>lib Loaded Configuration </span><span>File</span>:<span> (none) Scan </span><span>for</span> additional .ini files in:<span> (none) Additional </span>.ini files parsed: (none)
The method to modify the location of php.ini is as follows: The php.ini file is placed on /usr/local/lib by default,
You can use the --with-config-file-path parameter during compilation to modify the storage location of php.ini.
For example,
you can use --with-config-file-path=/etc
to store php.ini under /etc, and then copy php.ini-dist from the source package to / etc/php.ini.
All roads lead to Rome. When searching for the location of the php.ini file, you can refer to one of the two methods above, both of which can achieve your needs.