The php.ini file controls the application running on the server. The values “max_upload_size”, “max_execution_time”, etc were set on the php.ini file. If you need to change these values for any reason, you need to find the location of the php.ini file. Sometimes it’s really difficult to find the file location. In this article, I am going to share how to find php.ini locations on any server.
The Simple Way to Find PHP.INI file Location
We can find php.ini file location by different methods. Let’s discuss a few methods.
Method 1
Create a simple PHP script and store it to the “document root” of any server. Let’s save the file as “info.php”.
<?php
phpinfo();
?>
Now, upload the file to the server using the FTP client, If you create it on your system. Alternatively, you can create the file directly on the “document root” by accessing the server through SSH.
Now, check access the file via browser, as you upload the file to the document root.
websitename.com/info.php
You should get output something like this.
You can see the loaded configuration file with location of php.ini file, which is “/etc/php/7.4/apache2/php.ini”.
Method 2
This method is very simple if you have basic command-line knowledge. To grep the php.ini location on Ubuntu or any Linux-based server, run the following command on the terminal.
$ php --ini
You will get something like
You can see on the screenshot, second line has the php.ini location.
Bitnami PHP.INI file location
By default Bitnami php.ini location is
$ /opt/bitnami/php/etc/php.ini
Conclusion
In this short tutorial, you have learned to find php.ini location on the server. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.