File upload limit

How to edit php.ini to increase the file upload limit.

Most servers ship with a default upload limit of 2 MB. If you need to raise it, all it takes is a custom php.ini file placed in your /public_html/ directory.

Updating the upload limit

Create a php.ini file in /public_html/ and add the following lines:

  • upload_max_filesize = 8M — sets the maximum size of a single file that can be uploaded to the server
  • post_max_size = 8M — sets the maximum amount of data that can be sent via POST
  • memory_limit = 32M — sets the maximum amount of memory a PHP script is allowed to use

These values allow uploads of up to 8 MB. Need more? Simply swap 8M for a higher value like 16M or 64M.

Important

memory_limit must always be set higher than post_max_size, otherwise PHP will cap the available memory before the upload limit is even reached.

Our products and services

Web HostingReliable hosting services for websites of any scale.
Order
VPSFlexible cloud infrastructure with full root access.
Order
Dedicated ServersBare metal servers for maximum performance.
Order

Applying the settings account-wide

By default, a custom php.ini only applies to the directory it's placed in. To make your settings take effect across your entire account, add the following lines to the beginning of the .htaccess file in /public_html/. If the file doesn't exist yet, create it.

suPHP_ConfigPath /home/user/public_html

<Files php.ini>
order allow,deny
deny from all
</Files>

Replace user with your actual cPanel username.

The <Files> block also protects your php.ini from being accessed directly through a browser.

Verifying your PHP configuration

To confirm your changes are working, create a file called info.php in /public_html/ with the following content:

<?php
phpinfo();
?>

Then open your browser and navigate to:

yourdomain.com/info.php

You'll see a full overview of your current PHP configuration. Search for memory_limit, upload_max_filesize, or any other directive to verify the new values are active.

Remember to delete info.php once you're done — leaving it publicly accessible exposes sensitive server information.

Help

If you have any questions or need assistance, please contact us through the ticket system — we're always here to help!

Need help?Our engineers will help you free of charge with any question in minutesContact us