What is php.ini?

The php.ini file is the standard configuration file in PHP-based applications. It is used to set upload sizes, display errors, resource limits, file timeouts, and many other things to manage the Apache server.

You already have default PHP settings installed on your server. There’s no need to create or edit a php.ini file unless you need to modify one or more server settings.

However, if you’d like to make changes, keep reading to know how to edit existing php.ini files or create new ones.

How to Set Up a Custom php.ini File on SPanel

Php.ini files contain directives to manage PHP-based applications. You can create one or multiple php.ini files that affect how your website will function.

A php.ini file can be in different folders. For instance, you might have one custom php.ini file in the /home/username/public_html directory, and another one for image files in the /home/username/public_html/images directory.

To create a custom php.ini file, you’ll need to access the associated directory.

Use the following steps to set up a custom php.ini file in your SPanel :

  1. Log in to your SPanel account.
  2. Under Files, click on File manager 

What is php.ini?

  1. If you want to modify a PHP file, now is the time to navigate the public_html directory and edit the desired folder. The changes you make will only affect that folder and nothing else.

But, if you want to create custom php.ini files, go on with the next steps.

  1. Select public_html

What is php.ini?

  1. Scroll down to the toolbar beneath the list of PHP files and hit the “+” icon.

What is php.ini?

  1. In the pop-out, click New File

What is php.ini?

  1. Input php.ini as the new name and press OK.

What is php.ini?

  1. Next, add PHP directives. Use this complete list of PHP directives to guide you. Then, save your edits.
  2. In your web browser, open the phpinfo file and look for one of the directives you set. Ensure that the modifications are visible.

While you can build custom php.ini files for different directories on your website, you can choose to configure settings in a single php.ini file and then apply it to the entire site. 

The following section explores how to do this in a bit.

How to Modify php.ini Settings on SPanel

Use these steps to configure php.ini settings:

  1. In your SPanel, navigate to the Tools section

What is php.ini?

  1. Click on PHP INI Editor.

What is php.ini?

  1. Choose the desired domain if your account hosts multiple domains or subdomains.

What is php.ini?

  1. On the Editor page, overwrite custom values for PHP variables listed under Basic Editor.

What is php.ini?

  1. Hit Apply to save changes.

To configure it manually (from scratch), click on the Advanced Editor, and enter your PHP directives there.

Keep in mind that if you enter an incorrect PHP directive or settings, it will affect your website. 

Just to be sure, take note of these directives – 

Upload_max_filesize sets a limit on the maximum file size that can be uploaded via PHP. This choice affects the upload or attachment system of various software running on your server.

You should change the value to something a bit higher than the default value. Use a number followed by M to specify the size in megabytes.

Memory_limit places a limit on how much memory a PHP script can use at a particular time.

Max_execution_time setting prevents the server from being slowed down by poorly written scripts. The value is set to 30 seconds by default; if you increase it too much, your server’s performance will suffer. 

Comparably, max_input_time limits the amount of time a script can process data input, such as file and forms uploads. The default value is set to -1, which means the max_execution_time is used instead. Reset the value to 0 for unlimited time.

Allow_url_fopen allows you to open a URL. It activates the URL-aware fopen wrappers that will enable you to access domain files.

We suggest that you don’t make any changes to the advanced settings until you’re sure you’ve got things under wraps.

Rado

Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.

Write a Comment

Required*