1. bluehost knowledge base

How To Change Upload File Size Limit In PHP - Increase Upload Limits

By default, PHP has a limit set to 50 MB (megabytes) for uploading through PHP scripts on our servers. If you need a higher limit, you can usually change that through the php.ini file. This article will walk you through increasing the upload limits through php.ini.

You will need to have your PHP set in the cPanel to one of the Single php.ini options to do this. Neither the default nor FastCGI settings will work. To learn how to change the PHP option your account is using, please see PHP Version Selection.

It will not affect the phpMyAdmin in the cPanel, as that uses a different php.ini that is only accessible to the server administrators. To get started, access your Bluehost account, and to determine if you're using Bluerock or Legacy, please check this article.



Editing upload_max_filesize and post_max_size

Note: Legacy accounts will feature a horizontal navigation bar at the top of the screen, while Bluerock account users will see a vertical navigation menu on the left-hand side of the screen. If you are still unsure what interface your account uses, please see Bluerock vs. Legacy to determine which step to follow.

Bluerock

  1. Log in to your Bluehost control panel.
  2. Click on the Advanced tab from the side navigation menu to the left.
    rock-bh-advanced-tab
  3. In the File section, click the File Manager.
    rock-bluehost-file-filemanager
  4. Scroll down in the right-hand panel to the file php.ini, and right-click it.
  5. In the pop-up menu, select Edit.
  6. Use the keyboard shortcut to open the find pop-up window.

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

  7. In the Search text field, type upload_max_filesize and press enter.
  8. This will highlight upload_max_filesize = 50M. Change 50M to the size you need.
  9. Open the find pop-up again. In the Search text field, type post_max_size and press enter.
  10. Highlighted will be post_max_size = 50M. It will need to be changed to the same number as what was entered for upload_max_filesize.
  11. Click Save changes.

Note: If there's no php.ini on your File Manager, you can also generate and edit these PHP values and limits via MultiPHP INI Editor.

rock-phpini-bh.png

Legacy

  1. Log in to your Bluehost control panel.
  2. In the file section, open the File Manager. 
    legacy-file-manager
  3. Choose to open Web Root and Show hidden files, then click the Submit button.
    legacy-file-show-hidden-files
  4. Scroll in the right-hand panel to the file php.ini, and right-click it.
  5. In the pop-up menu, select Code Edit.
  6. Click Edit at the bottom of the pop-up for Character set selection.
  7. Use the keyboard shortcut to open the find pop-up window.

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

  8. In the Search text field, type upload_max_filesize and press enter.
  9. It will highlight upload_max_filesize = 50M. Change 50M to the size you need.
  10. Open the find pop-up again, and in the Search text field, now type post_max_size and press enter.
  11. Highlighted will be post_max_size = 50M. This will need to be changed to the same number as what was put in for upload_max_filesize.
  12. Click Save changes.

memory_limit

When the PHP engine is handling an incoming POST, it needs to 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 being 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 will need to change this to a larger value or remove the entry altogether.

Other Options

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

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 just a bit more effort than PHP, but it's worth it.

For further assistance, you may contact our Chat Support or Phone Support via 888-401-4678. You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.