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?, How to Set Up a Custom php.ini File on SPanel

  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?, How to Set Up a Custom php.ini File on SPanel 2

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

What is php.ini?, How to Set Up a Custom php.ini File on SPanel 3

  1. In the pop-out, click New File

What is php.ini?, How to Set Up a Custom php.ini File on SPanel 4

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

What is php.ini?, How to Set Up a Custom php.ini File on SPanel 5

  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?, How to Modify php.ini Settings on SPanel

  1. Click on PHP INI Editor.

What is php.ini?, How to Modify php.ini Settings on SPanel 2

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

What is php.ini?, How to Modify php.ini Settings on SPanel 3

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

What is php.ini?, How to Modify php.ini Settings on SPanel 4

  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.

Was this helpful?

What’s your goal today?

1. Find the right Web hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

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.