Creation of custom php.ini file in CPanel

In this section, we will learn the use of CPanel to create a custom php.ini file. The php.ini file is the most important configure file. In this file, we will declare our PHP settings changes. When we use php to run any application, it will be useful to solve the config while running. We will mostly use it at the time of file timeouts, resource limits, and controlling upload size. If we want to control many php settings, the php.ini file will be very useful for us because it provides directives. When we want to define the functions of the website, we can set up one or more than one custom php.ini file. The main page of our website might contain a custom file in our directory as /home/username/public_html. The image file of our website might contain a separate custom file in our directory as /home/username/public_html/images. The custom php.ini file will only affect the directory in which it is located by default.

We can use Godaddy cpanel and another hosting to create it. In CPanel, we can increase the memory_limit, max_file_uploads, upload_max_filesize, max_execution_time, post_max_size and may more things in php ini file.

In default php ini file, the basic configuration is provided by mostly server like hosting raja server, a2hosting server, and GoDaddy server. Sometimes, we are required to increase the memory limit of the file, maximum upload file size, etc. In case of the creation of php ini file, the different server uses different ways to create it. To explain it, we are providing two examples. In this example, we are going to see the creation of a custom php.ini file with a php ini file's change default value.

Creation of custom php.ini file in CPanel

We are going to make the following changes in our GoDaddy project's file named as .user.ini. So we have to put the following code on our root directory only because if we don't do this, it will affect our whole project.

Path: public_html/mypro.com/index.php

Create File Path: public_html/mypro.com/.user.ini

If any case, the above solution will not work, the alternative solution of this is described as follows:

Create File Path: public_html/mypro.com/php.ini

After this code, we can run the following command to check it:

Creation of custom php.ini file in CPanel




Latest Courses