VPS.TC
₺ | $
Server Status
Turkey Istanbul, Türkiye
Active
USA New York, USA
Active
Cart Total:
View Cart
How to Increase the WordPress Upload Limit
CMSs

How to Increase the WordPress Upload Limit

Avatar of Defne Defne 13 min read 0 Comments
Share:

Quick Summary – WordPress Upload Limit

WordPress uploads pass through several layers. Find the lowest active value, change only what the site needs, and verify the result from the web-facing PHP configuration.

  • Read the error — A WordPress size warning and an Nginx 413 response usually point to different layers.
  • Compare PHP values — Keep post_max_size above upload_max_filesize so the request has room for form data.
  • Check Nginx — Raise client_max_body_size when Nginx rejects the request before PHP.
  • Reload services — Reload PHP-FPM or Apache and Nginx after changing their configuration.
  • Separate memory — A larger upload limit does not automatically provide more PHP memory.
  • Keep it practical — Choose a limit based on the largest real file instead of setting an unnecessarily high value.

To increase the WordPress upload limit, first identify which layer is rejecting the file: PHP, Nginx, Apache, a proxy, or the hosting panel. Raise the lowest active setting, reload the service that owns it, and verify the result from WordPress instead of trusting the configuration file you happened to edit.

Why does the WordPress upload limit look so low?

WordPress does not get its upload limit from one switch. PHP’s upload_max_filesize and post_max_size, Nginx’s client_max_body_size, WordPress memory settings, a proxy, and sometimes the hosting panel can all affect the same request. The lowest active limit wins.

The error usually tells you which layer to inspect first. WordPress’s “The uploaded file exceeds the upload_max_filesize directive in php.ini” message commonly points to PHP or WordPress settings. An Nginx 413 Request Entity Too Large response means Nginx rejected the request before PHP received it.

🚀 Boost Your Speed with VPS Server!

Speed up your projects with high-performance SSD storage and 99.9% uptime guarantee.

Get VPS Hosting
Setting What it controls Where to check
upload_max_filesize Maximum size of one uploaded file PHP
post_max_size Total size of a POST request PHP
client_max_body_size Maximum Nginx request-body size Nginx
memory_limit Memory available to a PHP process PHP and WordPress

Start here: identify the exact error, check the values used by the web request, and raise only the lowest relevant limit. Changing every setting blindly makes the next failure harder to find.

Caution

Do not leave phpinfo files publicly accessible. They expose PHP versions, modules, paths, and configuration details that an attacker does not need to see.

How do you check the WordPress upload limit?

Open Media > Add New in the WordPress dashboard. WordPress displays the maximum permitted file size there. WooCommerce and form plugins may have separate upload fields, so check those screens as well.

With SSH access, first see which configuration the command-line PHP uses:

☁️ Gain Flexibility with Cloud Server!

Experience the power of cloud with scalable resources and instant backups.

Cloud Server Plans
php --ini
php -i | grep -E 'upload_max_filesize|post_max_size|memory_limit'

This is CLI PHP only. A site served through PHP-FPM may use a different PHP version and a different php.ini. That distinction caught me once: I edited the CLI configuration, ran the checks, and wondered why WordPress had not changed at all.

To inspect the web-facing PHP configuration, you can temporarily create a file such as:

<?php
phpinfo();

Put it in the document root as info.php, open it in a browser, and find the Loaded Configuration File line. The page also exposes PHP versions, modules, paths, and configuration details. Delete the file immediately after checking it.

PHP’s documentation specifies that post_max_size includes uploaded files and the other form data in the request. If upload_max_filesize is 128M but post_max_size is 32M, the 128M file cannot be uploaded.

Check three views: the WordPress dashboard, command-line PHP, and the PHP-FPM configuration used by the website. They are not guaranteed to match.

From the field

I once edited the CLI PHP configuration, ran the usual checks, and saw no change in WordPress. The site was using PHP-FPM with another php.ini; checking Loaded Configuration File in a temporary phpinfo page showed me exactly where I had gone wrong. I deleted the file immediately afterward.

Changing the PHP limits

On a VPS, the lasting fix is to edit the php.ini file belonging to the PHP version and service that handle the site. Paths vary by distribution and PHP version. On Ubuntu with PHP 8.2 and PHP-FPM, a common path is:

/etc/php/8.2/fpm/php.ini

Use values that match the actual workflow:

file_uploads = On
upload_max_filesize = 128M
post_max_size = 136M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300

Keeping post_max_size slightly above upload_max_filesize leaves room for the rest of the form data. For one 128M file, 136M is a reasonable starting point. Several files need a larger total.

memory_limit is not the size limit for a file on disk. It limits the memory PHP can use while WordPress creates thumbnails, processes images, or runs plugin code. Raising it for every site can become expensive when many PHP-FPM workers are active.

Reload the service after saving the file:

sudo systemctl reload php8.2-fpm
sudo systemctl reload nginx

Your unit may have another name. Confirm it with systemctl status php8.2-fpm. An Apache site using mod_php may need an Apache reload instead of a PHP-FPM reload.

Read the new value in WordPress after the reload. Do not trust the file you edited until the web request sees it.

Fixing a 413 error with Nginx

Nginx can reject an upload before PHP sees it. Its documented default for client_max_body_size is 1 MB, which is enough to surprise anyone uploading a large theme or media file.

Add the directive inside the relevant server block:

server {
    server_name example.com www.example.com;
    client_max_body_size 128M;

    # Other site settings
}

The virtual host is often stored at /etc/nginx/sites-available/example.com and enabled through sites-enabled. Test the configuration before applying it:

sudo nginx -t
sudo systemctl reload nginx

Wait for syntax is ok and test is successful. A reload is preferable to a restart for this change because it applies the new configuration while allowing existing connections to finish where possible.

If PHP allows 128M but Nginx allows 64M, the practical limit is 64M. The reverse can happen too. A reverse proxy, WAF, or CDN in front of Nginx may impose another limit, so inspect that layer when the local configuration looks correct.

For a 413 response, check client_max_body_size and the Nginx error log first.

Tip

Run nginx -t before reloading Nginx. This small check has saved me from turning a simple upload-limit change into an avoidable outage.

Apache, .htaccess, and hosting-panel settings

Apache and PHP behave differently depending on how the stack is connected. With Apache and mod_php, these directives may work in .htaccess:

php_value upload_max_filesize 128M
php_value post_max_size 136M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

They may not work with PHP-FPM or CGI. In the wrong setup, they can cause a 500 response. Remove the lines and inspect the Apache error log if that happens.

In cPanel and Plesk, values such as upload_max_filesize, post_max_size, and memory_limit can usually be changed through the interface. Check that the selected PHP version is the one the website actually uses. The management differences discussed in cPanel vs Plesk: Which Hosting Control Panel Is Better? are relevant here.

Some shared hosting plans prevent customers from changing these values. If edits to php.ini, .user.ini, or .htaccess do nothing, the provider’s package limit may be taking precedence. Ask support for the highest permitted values instead of repeatedly changing the same file.

For PHP installations that use .user.ini, an example is:

upload_max_filesize=128M
post_max_size=136M
memory_limit=256M

PHP may reread .user.ini files only at intervals. A delayed change can be normal, especially when PHP-FPM or a hosting-panel layer is involved.

Upload size and memory are different limits

No, they are not the same. The upload limit controls the size of an HTTP request. The WordPress memory limit controls how much RAM PHP can use while processing it. A large ZIP may mainly need disk space and enough request time; resizing a high-resolution JPEG can require much more memory.

You can add these constants to wp-config.php:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

WP_MEMORY_LIMIT applies to normal site operations, while WP_MAX_MEMORY_LIMIT is used by the administration area and some heavier tasks. If PHP’s memory_limit is lower, WordPress cannot exceed it. Editing only wp-config.php will not solve every memory error.

If you see Allowed memory size exhausted, inspect PHP memory, PHP-FPM worker counts, image processing, and plugins. The separate troubleshooting steps in How to Fix the WordPress Memory Limit Error are useful here.

Treat upload size and PHP memory as separate measurements. Increasing one does not automatically increase the other.

Why did the change have no effect?

The usual culprit is the wrong PHP version. PHP 8.1 and 8.2 may both be installed while the Nginx site uses PHP 8.2-FPM and you edited the PHP 8.1 file. Check the socket configured for the site:

grep -R "fastcgi_pass" /etc/nginx/sites-enabled/
ps aux | grep '[p]hp-fpm'

The second command avoids matching its own grep process. Small detail, but it makes the output less confusing.

A lower layer may also be overriding the value. If Nginx allows 32M and PHP allows 128M, WordPress still cannot receive a file larger than 32M. A CDN, reverse proxy, firewall, or hosting panel can stop the request earlier.

Check service reloads and caches too. PHP-FPM may still have old workers, Apache may still be running old processes, or the panel may not have applied the setting. Write down the value shown in WordPress before and after the change. Measure it.

Check disk space in both the temporary upload directory and the WordPress uploads directory:

df -h
sudo du -sh /tmp /var/www/example.com/wp-content/uploads

Permission problems produce different symptoms. If the web-server user cannot write to the destination, increasing the upload limit will not help. Changing the directory to chmod 777 only hides the real problem and weakens the permissions.

Example

If PHP allows 128M but Nginx allows 64M, the effective WordPress upload limit is 64M. If a CDN allows only 32M, the CDN becomes the limiting layer instead.

Is a high upload limit safe?

A value such as 128M or 512M is not automatically a vulnerability, but it permits larger requests and can consume more resources. Allow only the file types the site needs, protect administrator accounts with multifactor authentication, and prevent executable scripts from running in the upload directory.

Unnecessarily high max_execution_time and max_input_time values can keep PHP workers busy during slow uploads. On a small VPS, watch CPU, RAM, disk I/O, and PHP-FPM processes while testing concurrent uploads.

A CDN can improve media delivery, but it does not remove the origin upload limit. The application still has to accept the request. For the surrounding setup, see How to Install WordPress on a VPS: Step-by-Step Guide, How to Install and Configure Nginx on Ubuntu, and What Is a CDN? How It Speeds Up Websites.

Set the limit slightly above the largest file users genuinely need, then watch the logs during one real upload. That final test is worth more than another round of guessing.

Check These Before Raising the Limit

  • Read the exact WordPress or web-server error.
  • Check the active PHP-FPM version and configuration file.
  • Set post_max_size above upload_max_filesize when form data needs room.
  • Raise client_max_body_size when Nginx handles the site.
  • Reload the relevant PHP and web-server services.
  • Confirm the new value in the WordPress Media screen.
  • Check disk space, permissions, logs, and resource use during a large upload.

Set the WordPress upload limit around the largest file your users genuinely need, then test one real upload while watching the PHP-FPM and web-server logs. That final verification is worth more than another round of guessing.

Explore VPS plans

Frequently Asked Questions

What is the default WordPress upload limit?

There is no single WordPress-wide default. The displayed limit comes mainly from the active PHP configuration and can also be constrained by Nginx, Apache, a proxy, or the hosting provider. Shared hosting packages often impose their own maximum. Check Media > Add New in WordPress, then compare that value with the PHP-FPM configuration used by the website.

Why does WordPress still show a low upload limit after editing php.ini?

You may have edited the wrong php.ini. CLI PHP, PHP-FPM, Apache, and different PHP versions can use separate configuration files. Check the website's PHP-FPM socket and verify Loaded Configuration File through a temporary phpinfo page. Reload the relevant service afterward, and remove the phpinfo file when finished.

What should post_max_size be for a 128M upload?

Set post_max_size slightly higher than upload_max_filesize so the request has room for form fields and other POST data. A value of 136M is a reasonable starting point for one 128M file, but several files require a larger total. The practical limit is still the lowest value enforced by PHP, Nginx, a proxy, or the hosting panel.

How do I fix the Nginx 413 Request Entity Too Large error?

Add or raise client_max_body_size in the relevant Nginx server block, for example to 128M. Run nginx -t and confirm both syntax is ok and test is successful before reloading Nginx. If the error remains, inspect reverse proxies, CDNs, firewalls, and the Nginx error log because another layer may have its own request-size limit.

Does increasing the upload limit require more WordPress memory?

Not always. A large ZIP may mainly require disk space and enough request time, while image resizing can require substantial PHP memory. Keep upload size and memory_limit separate. If WordPress reports Allowed memory size exhausted, inspect PHP memory, worker counts, image processing, and plugins instead of raising the upload limit alone.

Is it safe to set the WordPress upload limit to 512M?

A 512M limit is not automatically unsafe, but it permits larger requests that consume more disk, CPU, RAM, and PHP worker time. Allow only the file types the site needs, protect administrator accounts with multifactor authentication, prevent script execution in uploads, and monitor logs and resources. Choose the smallest limit that supports the real workflow.

Sources

Avatar of Defne
Author

Defne