Loading...

Knowledge Base

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.

Editing upload_max_filesize and post_max_size

  1. Log in to your Bluehost Account Manager.
  2. Click Hosting in the left-hand menu.

    Bluehost Account Manager - Hosting Tab
     

  1. Click the FILE MANAGER button.
  2. Scroll down in the right-hand panel to the file php.ini and right-click it.
  3. In the pop-up menu, select Edit.
  4. Use the keyboard shortcut to open the find pop-up window.
  5. Find the upload_max_filesize setting, type it into the search bar, and hit enter.
  6. 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.
  7. Open the find pop-up and type post_max_size in the Search field. Press enter.
  8. Highlighted will be post_max_size = 50M. It must be changed to the same number entered for upload_max_filesize.

    example image php settings php values for post_max_size and upload_max_filesize
     

  9. To save the changes, please click on the Save button.

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 accepting input. If several megabytes of data are transferred, max_input_time should be reasonably high.

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...