This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

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

PHP has, by default, a limit set to 50 MB (megabytes) for uploading through PHP scripts on our servers. If you need to have a higher limit you can usually just change that through the php.ini file. This article will step you through on how to increase 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 be able to do this. FastCGI and the default will not work. To learn how to change the PHP option your account is using, go to PHP Version Selection (PHP Config).
This will not affect the phpMyAdmin in the cPanel, as that uses a different php.ini that is only accessable to the server administrators.


Editing upload_max_filesize and post_max_size

  1. Login to your Just Host Control Panel.
  2. Open the File Manager and select to go to the Web Root and click Go.
  3. Then scroll in the right-hand panel to the file php.ini and right-click it.
  4. In the pop-up menu select Code Edit.
  5. Click Edit at the bottom of the pop-up for Character set selection.
  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 and in the Search text field now type post_max_size and press enter.
  10. 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.
  11. 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 has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might affect the whole server as well.

max_execution_time and max_input_time

These settings define the maximum lifetime of the script and the time that the script should spend in accepting input. If several megabytes of data are being transfered 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.

Special Notes:

Apache Settings

The apache web server has a LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. Some RPM installations sets 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 as well but perl is just slightly ahead when it comes to 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.

Knowledgebase Article 636,858 views bookmark tags: optimize php upload uploads


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

Where do I Change my Mailbox (Size) Quota? How do I Increase or Decrease Mailbox (Storage) Quota?
Knowledgebase Article 430,141 views tags: account change decrease email increase mailbox quota size

How to install the php.ini file and then increase the PHP Memory limit.
Video "How-to" Tutorial 497,119 views tags: limit troubleshooting wordpress

Database Size and Table Limits.
Knowledgebase Article 218,228 views tags: database limits size tables

Related Help Content

Can I send an email with large files/attachments?
Knowledgebase Article 399,101 views tags: email limits

This article will walk you through uploading files using the File Manager
Knowledgebase Article 381,818 views tags: cpanel file upload

This article will explain how to run php and other file types using Cron jobs.
Knowledgebase Article 525,179 views tags: cron file jobs php

How to change your PHP version in your hosting account
Knowledgebase Article 903,955 views tags: config php selection version

This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files.
Knowledgebase Article 408,421 views tags: htaccess php

Changing PHP versions, load custom Apache mods, and other Apache/PHP customizations
Knowledgebase Article 154,826 views tags: easyapache php vps whm

The php.ini file can be viewed from a web browser.
Knowledgebase Article 156,684 views tags: exploit hide php prevent

Available PHP Memory Exhausted.
Knowledgebase Article 300,366 views tags: exceeded fatal memory php wordpress

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.