Home >Backend Development >PHP Tutorial >Where is the Php.ini file location? The Php.ini file cannot be found_PHP tutorial
The Php.ini file is a configuration file of PHP. In the Windows host, if you have not modified the configuration file, the php.ini file must be together with your PHP installation directory, but it seems to be different in Linux. Let me introduce the search below. php.ini location method. under linux
The most likely location is: /etc directory or /usr/local/lib directory.
If you still can’t find the location, then use the ultimate solution:
Create a new php file and write the following code Save it, then visit the page in the browser and search for php.ini. Congratulations, the location of the php.ini file you are looking for has been found. (Using this method to find the location of the Php.ini file is a great trick under both Linux and Windows)
Use the command line /data/php/bin/php on the linux server a.php | grep php.ini
Show
Configuration File (php.ini) Path => /data/php/etc Loaded Configuration File => /data/php/bin/php.ini
The permissions of /data/php/bin/php.ini are used on the Linux server: nginx+php
-rwxrwxrwx. 1 root root 69737 February 3 13:49 /data/php/bin/php.ini
What should I do to browse a.php in the browser? Display Loaded Configuration File => /data/php/bin/php.ini
What is the main difference between running php command line and browsing php files in a browser
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, store it under /etc, and then copy php.ini-dist from the source package to /etc/php.ini.
windows
In the php installation folder.
There are two similar to php.ini-xxxxxxxx. You choose one and delete "-xxxxxxxxx" to use this one.