The php.ini file is a PHP configuration file that can change the values of certain PHP directives and activate additional PHP modules/extensions. That file is created in the cgi-bin folder of your Linux Websites Hosting space. The file can be edited via text editor. You can find the directives that can be managed via php.ini file here.
This article contains the following sections:
- What is a php.ini file?
- How to create and upload a php.ini file?
- What can the php.ini file be used for?
I. What is a php.ini file?
The php.ini file is where you configure custom PHP settings. You can use the default settings for the server, change specific settings by editing the existing php.ini, or create a new text file and name it php.ini.
You can use the default settings, but in some occasions you might need to update them to suit your individual needs. In that occasion, you will have to create the file.
II. How to create and upload a php.ini file?
You can create such a file with text editors such as Notepad, Wordpad, etc. You should name the file exactly php.ini or otherwise it will not work.
Use your preferred text editor, create a file named php.ini on your desktop or any other local folder, add the desired configuration values and then upload the file using an FTP client. Instructions on how to establish an FTP connection can be found here. Once you establish the FTP connection, you have to drag and drop the newly created file from your computer to the cgi-bin folder on your hosting space.
III. What can the php.ini file be used for?
Most of the settings listed here can be adjusted via this file. Here, we will provide you with the most commonly updated settings with a php.ini file:
3.1 file_uploads - By default, this is set to On. If you want to update it, the text that you will need to add is:
3.2 max_execution_time - What this settings does is to configure the execution time, which is the total time the script runs, including database queries, regardless whether it's running in loops or not. By default, this value is set to 30 (in seconds). If you want to update it, the text that you will need to add is:
3.3 max_file_uploads - It allows you to increase or decrease the number of files that can be uploaded. By default, this value is set to 20. If you want to update it, the text that you will need to add is:
3.4 memory_limit - This value shows how much RAM on the server can be used to process a certain script of yours, before an 500 Internal Server Error is displayed by the browser. By default, this value is set to 128 MB and that should be more than enough. However, if you want to update it, the text that you will need to add is:
3.5 post_max_size - Using that value, you will set the Maximum size of POST data that PHP will accept. By default, this value is set to 8 MB. If you want to update it, the text that you will need to add is:
3.6 upload_max_filesize - This value will allow you to upload a larger file if that is needed. By default, this value is set to 2 MB. If you want to update it, the text that you will need to add is: