PHP Maximum Upload File-size Increase

1 min read

Updated on August 26, 2026

Upload limit

The PHP upload limit controls the largest file that can be sent to your site, whether that is a theme, a plugin, a video or a database import. If a file exceeds the limit, the upload fails with a message saying the file is too large. Sizes are given in bytes by default, but you can write them in megabytes or gigabytes by adding M or G.

Option 1: change it in cPanel #

This is the easiest route and it applies to the whole account. Go to cPanel > Select PHP Version > Options, then adjust upload_max_filesize, post_max_size and memory_limit. Changes take effect immediately, with nothing to save in a file.

Option 2: set it in .htaccess #

Use this when you want the limit to apply to one site or folder only. Go to cPanel > File Manager, open the folder where the website lives, right-click .htaccess, choose Edit, and add:

php_value memory_limit 256M
php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 300
php_value max_input_time 300
php_value max_input_vars 3000

Get the order right #

These three values depend on each other, and setting them in the wrong order is the most common reason an upload still fails after the limit has been raised:

  • post_max_size must be equal to or larger than upload_max_filesize, because the file travels inside the POST request.
  • memory_limit should be equal to or larger than post_max_size.

So 256M / 256M / 256M works, and so does 512M memory with 256M post and 256M upload. But a 256M upload limit with a 128M post limit will always fail at 128M.

WordPress: raise the memory limit too #

WordPress applies its own memory cap on top of PHP. Add these lines to wp-config.php, above the line that reads That’s all, stop editing! Happy publishing.

/* Increase memory limits */
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

/* Allow larger uploads in the media library */
@ini_set( 'upload_max_filesize', '256M' );
@ini_set( 'post_max_size', '256M' );
@ini_set( 'max_execution_time', '300' );

Checking it worked #

In WordPress, go to Tools > Site Health > Info > Server and look at the upload and memory values. If they still show the old numbers, the change has not taken effect and the notes below usually explain why.

If nothing changes #

  • On some server configurations php_value in .htaccess is ignored, and a 500 error appears instead. If that happens, remove the lines and use the cPanel method above.
  • If you cannot see .htaccess in File Manager, open Settings in the top right corner and tick Show hidden files.
  • If it still does not appear, create a new file named .htaccess in that folder.
  • Very large uploads are often better done over FTP or SFTP, which has no PHP limit at all.