Loading...

Knowledge Base
Up to 75% off on hosting for WordPress websites and online stores

How to Increase PHP Limits

How do you increase PHP limits? PHP has a default limit of 50 MB (megabytes) set for uploading through PHP scripts on our servers. If you need to upload files larger than this limit, you can increase it by editing the php.ini file. This article will guide you through updating the upload limits via php.ini.

You must set your PHP in the cPanel to one of the Single php.ini options to accomplish this task. Please note that neither the default nor FastCGI settings will work for this purpose. To learn how to change the PHP option for your account, please refer to PHP Version Selection.

Changing the php.ini file in your account will not impact the phpMyAdmin tool in cPanel. This is because phpMyAdmin uses a different php.ini file that is accessible only to the server administrators. To begin, log in to your Bluehost account.



Editing upload_max_filesize and post_max_size

  1. Log in to your Bluehost Account Manager.
  2. After logging in, go to the Hosting tab in your Account Manager dashboard.
  3. Under the All My Hosting Packages section, select the name of the hosting package you wish to manage. 
    • If you have more than one hosting package in your account, click on the Manage button of the hosting package you want to manage.
    • If you only have one hosting package in your account, you will be redirected to the Hosting Overview page.
  4. Click the FILE MANAGER button under the Quick Links section.

    Tip: You can access the public_html folder if you are working on the primary domain of your account or access the root - a folder with the name of the specific addon domain you'd like to work on. These folders usually house your php.ini file.

  5. Scroll down in the right-hand panel to the file php.ini and right-click it.
  6. In the pop-up menu, select Edit.
  7. Use the keyboard shortcut to open the find pop-up window.

    Windows and Linux: Ctrl + f
    Mac: Command (⌘) + f

  8. Find the upload_max_filesize setting, type it into the search bar, and hit enter.
  9. Increase the maximum file size that can be uploaded, look for the line upload_max_filesize = 50M, and change the value 50M to the desired size.
  10. Open the find pop-up and type post_max_size in the Search field. Press enter.
  11. Highlighted will be post_max_size = 50M. It must be changed to the same number entered for upload_max_filesize.
    upload_max_filesize
  12. To save the changes, please click on the Save button.

Note: If you cannot locate php.ini in your File Manager, you may generate and modify PHP values and limits using MultiPHP INI Editor.

memory_limit

When the PHP engine handles an incoming POST, it must keep some of the incoming data in memory. This directive only affects if you have used the --enable-memory-limit option during configuration. Setting too high a value can be very dangerous, as several uploads being handled concurrently can lead to memory limits maxing out and server performance issues.

max_execution_time and max_input_time

These settings define the script's maximum lifetime and the time the script should spend in accepting input. If several megabytes of data are transferred, max_input_time should be reasonably high.

You can override the setting in the .ini file for max_input_time by calling the set_time_limit() function in your scripts.

Apache Settings

The Apache web server has a LimitRequestBody configuration directive that restricts all POST data sizes, regardless of the web scripting language in use. Some RPM installations set the limit request body to 512Kb. You must change this to a larger value or remove the entry altogether.

Other Options

If you expect to handle many concurrent file transfers on your website, consider using a PERL or Java server-side component. PHP is our favorite web programming language, but PERL can offer a slight advantage when handling files.

Most installations of PERL as an Apache module can accept up to 32 megabytes out of the box. Compare this against the 2MB default for PHP. The downside is that PERL coding takes more effort than PHP, but it's worth it.

Summary

If you need to upload files larger than the default limit of 50 MB set for uploading through PHP scripts on your servers, you can increase it by editing the php.ini file. Following the steps outlined in this article, you can easily increase PHP limits via php.ini. Remember to set your PHP in the cPanel to one of the Single php.ini options to accomplish this task. Additionally, be mindful of the various settings, such as memory_limit and max_execution_time, that can affect the performance of your server. If you encounter any issues or have further questions, don't hesitate to contact support for assistance.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Did you find this article helpful?

 
* Your feedback is too short

Loading...