When you use and manage a VPS/server running Linux with a website using PHP source code, you are probably no longer unfamiliar with the ‘php.ini’ file because to edit or change related configurations regarding the PHP Backendoperation, you need to edit this file directly.
What is a php.ini file?
Note: If you use Shared Hosting services, the provider will not let you set up the php.ini file yourself, either there will be a similar file named user.ini or no file at all.
The file ‘php.ini’ is a configuration file that translates and processes PHP code. And for some reason, if you need to edit the parameters in this file to better suit the source code or programming needs, now it’s time to determine the exact path of the php.ini file to be able to adjust. It is quite important to adjust the desired configuration.
Because there are now many Control Panels, Scripts, and modules, each control will have different php.ini file locations or there may be many different php.ini files on the same server, resulting in a file some users edit the php.ini file at the default path, causing the configuration edit to fail.
Locate the file php.ini
To quickly locate the php.ini file on a Linux server, there is a quick way you can apply that is to use the command line on Linux, with this way, you don’t need to care what you are using control, script because it will automatically list the exact path according to the control, the script you are using.
Step 1: SSH into your server
To upgrade the ProFTPD version on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
Step 2: Use the Command line
To quickly and accurately locate the php.ini file, you can use the command below:
php -i | grep "Loaded Configuration File"
Explanation of the above command:
- php -i | grep “Loaded Configuration File”: Quickly find the Loaded Configuration File value (this value is the path of the php.ini file)
Here are the results of some common php.ini file paths that you often encounter:
[trungkie@chv10-24851 ~]$ php -i | grep "Loaded Configuration File" Loaded Configuration File => /opt/alt/php74/etc/php.ini
[root@sv ~]# php -i | grep "Loaded Configuration File" Loaded Configuration File => /usr/local/php72/lib/php.ini
[root@sv ~]# php -i | grep "Loaded Configuration File" Loaded Configuration File => /www/server/php/74/etc/php.ini
- Hostvn Script
[root@sv ~]# php -i | grep "Loaded Configuration File" Loaded Configuration File => /etc/php.ini
So in this article, AZDIGI showed you how to quickly locate the php.ini file on your Linux server so that you can edit the PHP configuration correctly. Hope this article will help you, wish you success!
You can refer to other instructions at the link below:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 730 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: email@example.com .