WordPress 413 request entity too large как исправить

Ошибка HTTP 413 Request Entity Too Large появляется, когда пользователь пытается загрузить на сервер слишком большой файл. Размер определяется относительно лимита, который установлен в конфигурации. Изменить его может только администратор сервера. 

Что делать, если вы пользователь

Если вы видите ошибку 413, когда пытаетесь загрузить файл на чужом сайте, то вам нужно уменьшить размер передаваемых данных. Вот несколько ситуаций.

  • Если вы пытались загрузить одновременно несколько файлов (форма позволяет так делать), попробуйте загружать их по одному.
  • Если не загружается изображение, уменьшите его размер перед загрузкой на сервер. Можно сделать это с помощью онлайн-сервисов — например, Tiny PNG.
  • Если не загружается видео, попробуйте сохранить его в другом формате и уменьшить размер. Можно сделать это с помощью онлайн-сервисов — я использую Video Converter.
  • Если не загружается PDF-документ, уменьшите его размер. Можно сделать это с помощью онлайн-сервисов — я обычно использую PDF.io.

Универсальный вариант — архивация файла со сжатием. Ошибка сервера 413 появляется только в том случае, если вы пытаетесь одновременно загрузить слишком большой объем данных. Поэтому и выход во всех ситуациях один — уменьшить размер файлов.

Ошибка 413

Комьюнити теперь в Телеграм

Подпишитесь и будьте в курсе последних IT-новостей

Подписаться

Исправление ошибки сервера 413 владельцем сайта

Если вы владелец сайта, который при загрузке файлов выдает ошибку 413, то необходимо изменить конфигурацию сервера. Порядок действий зависит от используемых технологий.

Чтобы понять, что стало причиной ошибки, нужно посмотреть логи. Это поможет сэкономить время. Вот подробная инструкция, которая рассказывает, как посмотреть логи в панели управления Timeweb. В зависимости от того, какая информация будет в логах, вы поймете, как исправлять ошибку 413.

Увеличение разрешенного размера для загрузки файлов на Nginx и Apache

На Nginx максимально допустимый размер файла задан в параметре client_max_body_size. По умолчанию он равен 1 МБ. Если запрос превышает установленное значение, пользователь видит ошибку 413 Request Entity Too Large. 

Параметр client_max_body_size находится в файле nginx.conf. Для его изменения нужен текстовый редактор — например, vi.

Подключитесь к серверу через SSH и выполните в консоли следующую команду:

Во встроенном редакторе vi откроется файл nginx.conf. В разделе http добавьте или измените следующую строку:

client_max_body_size 20M;

Сохраните и закройте файл. Затем проверьте конфигурацию файла:

Перезагрузите сервер следующей командой:

После перезагрузки будет действовать новая конфигурация с увеличенным лимитом на размер загружаемого файла.

На Apache опция, устанавливающая максимально допустимый размер загружаемого файла, называется LimitRequestBody. По умолчанию лимит не установлен (равен 0). 

На CentOS главный конфиг располагается по адресу /etc/httpd/conf/httpd.conf. На Debian/Ubuntu — по адресу /etc/apache2/apache2.conf

Значение задается в байтах:

LimitRequestBody 33554432

Эта запись выставляет максимально допустимый размер 32 МБ.

Изменить конфиги можно также через панель управления. Я пользуюсь ISPmanager, поэтому покажу на ее примере.

  1. Раскройте раздел «Домены» и перейдите на вкладку «WWW-домены».
  2. Выберите домен, на котором появляется ошибка, и нажмите на кнопку «Конфиг».

Apache и Nginx конфиги

Появится вкладка с конфигами Apache и Nginx. Вы можете редактировать их вручную, устанавливая лимит на размер загружаемого файла.

Исправление ошибки на WordPress

На WordPress ошибку можно исправить двумя способами.

Способ первый — изменение разрешенного размера в файле functions.php. Этот файл отвечает за добавление функций и возможностей — например, меню навигации.

  1. Откройте файловый менеджер.
  2. Перейдите в папку public.html.
  3. Откройте директорию wp-content/themes.
  4. Выберите тему, которая используется на сайте с WordPress.
  5. Скачайте файл functions.php и откройте его через любой текстовый редактор.

В панели управления на Timeweb можно также воспользоваться встроенным редактором или IDE — путь будет такой же, как указан выше: public.html/wp-content/themes/ваша тема/functions.php

В конце файла functions.php добавьте следующий код: 

@ini_set( 'upload_max_size' , '256M' );

@ini_set( 'post_max_size', '256M');

@ini_set( 'max_execution_time', '300' );

Сохраните изменения и загрузите модифицированный файл обратно на сервер. Проверьте, появляется ли ошибка 413. 

Редактирование файла functions.php

Второй способ — изменение файла .htaccess. Это элемент конфигурации, который способен переопределять конфигурацию сервера в плане авторизации, кэширования и даже оптимизации. Найти его можно через файловый менеджер в папке public.html.

Скачайте файл на компьютер, на всякий случай сделайте резервную копию. Затем откройте .htaccess в текстовом редакторе и после строчки #END WORDPRESS вставьте следующий код:

php_value upload_max_filesize 999M

php_value post_max_size 999M

php_value max_execution_time 1600

php_value max_input_time 1600

Сохраните файл и загрузите его обратно на сервер с заменой исходного файла. То же самое можно сделать через встроенный редактор или IDE в панели управления Timeweb.

Исправление ошибки при использовании PHP-скрипта

Если файлы загружаются с помощью PHP-скрипта, то для исправления ошибки 413 нужно отредактировать файл php.ini. В нем нас интересуют три директивы.:

  • upload_max_filesize — в ней указан максимально допустимый размер загружаемого файла (значение в мегабайтах);
  • post_max_size — максимально допустимый размер данных, отправляемых методом POST (значение в мегабайтах);
  • max_execution_time — максимально допустимое время выполнения скрипта (значение в секундах).

Например, если я хочу, чтобы пользователи могли загружать файлы размером до 20 МБ, то я делаю так:

max_execution_time = 90

post_max_size = 20M

upload_max_filesize = 20M

Если все значения указаны верно, то файлы с допустимым размером будут загружаться на сервер без ошибок.

То же самое можно сделать через панель управления. Например, в ISPmanager порядок будет такой:

  1. Авторизуйтесь с root-правами.
  2. В левом меню раскройте раздел «Настройки web-сервера» и перейдите на вкладку «PHP».
  3. Выберите используемую версию и нажмите на кнопку «Изменить».

Изменение конфигурации PHP

На экране появится список параметров. Они отсортированы по алфавиту. Установите необходимые значения для параметров max_execution_time, post_max_size и upload_max_filesize. Изменения применяются автоматически.

VDS Timeweb арендовать

WordPress errors come in all shapes and sizes. In most cases they’re easy to decipher; such is the accessibility of WordPress’ error reporting. Even so, when the “413 Request Entity Too Large” error pops up, it can leave you scratching your head.

Without realizing it, you already have everything you need to understand and diagnose the error within its name. The good news is you won’t need more than a standard Secure File Transfer Protocol (SFTP) client and administrator access to your server.

In this post, we’ll take a look at how to solve the “413 Request Entity Too Large” error. We’ll also give you a quick list of steps to take before you begin to solve the error, to make the process super straightforward.

Check out our video guide to fixing the “413 Request Entity Too Large” Error

What the “413 Request Entity Too Large” Error Is (And Why It Exists)

We noted that there’s a clue in the error name as to what the solution and problem are. Before you go sleuthing yourself, though, we’ll spoil the surprise: it’s in the adjective “large.”

In a nutshell, the “413 Request Entity Too Large” error is a size issue. It happens when a client makes a request that’s too large for the end server to process. Depending on the nature of the error, the server could close the connection altogether to prevent further requests being made.

Let’s break the error down into its parts:

  • “413”: This is one of the 4xx error codes, which mean there’s a problem between the server and browser.
  • “Request Entity”: The “entity” in this case is the information payload being requested by the client from the server.
  • “Too Large”: This is straightforward: the entity is bigger than the server is willing or able to serve.

In fact, this error has changed its name from what it originally was to be more specific and offer more clarity. It’s now known as the “413 Payload Too Large” error, although in practice, you’ll see the older name a lot more.

As for why the error occurs, the simple explanation is that the server is set up to deny explicit uploads that are too large. Think of times when you upload a file where there’s a maximum file size limit:

The TinyPNG home page with the max upload of 5mb highlighted.

The TinyPNG home page.

In most cases, there will be some validation in place to stop the error… if you’re seeing the “413 Request Entity Too Large” error, those validation efforts may not be as watertight as you think.

What You’ll Need to Resolve the “413 Request Entity Too Large” Error

Fixing this error is all about raising the maximum file size for the server in question. Once that’s out of the way, you shouldn’t see the error anymore.

As such, to fix the “413 Request Entity Too Large” error, you’ll need the following:

  • Administrator access to your server.
  • A suitable SFTP client (we’ve covered many of these in the past).
  • The know-how to use SFTP — there’s a good guide to the basics on WordPress.org, and you won’t need more than that.
  • A text editor, though there’s no need for anything too complex.
  • A clean and current backup in case the worst happens.

As an aside, we mention SFTP throughout this article as opposed to FTP. In short, the former is more secure than the latter (hence the name). That said, while there are other differences you should investigate, the functionality remains the same for the vast majority of uses.

Also, it’s worth noting that the MyKinsta dashboard has plenty of functionality on hand to help you get onto your server. For example, each site displays SFTP connection information that’s easy to understand:

The SFTP panel in the MyKinsta dashboard.

The SFTP panel in the MyKinsta dashboard.

This can help you get into your site without fuss. In some cases, you may be able to import the credentials straight to your chosen SFTP client.

3 “Pre-Steps” You Can Take Before Rectifying the “413 Request Entity Too Large” Error

Before you crack open your toolbox, there are some steps you can take to help resolve the “413 Request Entity Too Large” error. Here are two — and each one may give you a welcome workaround to the error.

1. Try to Upload a Large File to Your Server Through SFTP

Because the issue is related to the file sizes hitting your server, it’s a good idea to circumvent the frontend interface and upload a large file to the server yourself. The best way to do this is through SFTP.

This is because protocols such as SFTP are almost as “close to the bone” as you can get with regards to the way you access your server. Also, you can simultaneously rule out any issues with the frontend that may be causing the error.

To do this, log into your site through SFTP and find the wp-content folder. In here will be the uploads folder.

The uploads folder seen from an SFTP client.

The uploads folder seen from an SFTP client.

Next, upload your file to this folder on the server and see what the outcome is. If the upload is successful, we suggest sending an email to the site’s developer, as they may want to investigate the issue further on the frontend.

2. Check for Server Permissions Errors

Of course, permissions errors will stop any server request from running. As such, you should check whether the user has sufficient permissions to upload files of any size. Once this is sorted, the error should disappear.

The first step is to determine whether this is an issue with a single user (in which case they may be restricted for a reason). If the “413 Request Entity Too Large” error is happening for multiple users, you can be more sure of something that needs your input.

We’d suggest two “pre-fixes” here:

  • Double-check your WordPress file permissions, just in case there’s an issue.
  • Remove and re-create your SFTP user (a general investigation is a great idea).

While they may not solve the error in the first instance, you’ll at least know that your file and user structure is as it should be.

How to Solve the “413 Request Entity Too Large Error” for Your WordPress Website (3 Ways)

Once you’ve gone through the pre-steps, you’re ready to tackle the error head-on.

The following three methods are listed from easiest to toughest, with the understanding that that the path of least resistance is the best one to take.

1. Edit Your WordPress functions.php File

First off, you can work with your functions.php file to help bump up the file upload size for your site. To do this, first log into your site through SFTP using the credentials found within your hosting control panel.

When you’re in, you’ll want to look for the file itself. The functions.php file should be in the root of your server. In many cases, this root is called www or public_html, or it could be the abbreviated name of your site.

Once you’ve found it, you can open it in your text editor of choice. If you don’t see the file, you can create it using your text editor.

Once you have a file open, enter the following:

@ini_set( '_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

In short, this increases the maximum file size of posts and uploads while boosting the time the server will spend trying to process the request. The numbers here could be anything you wish, but they should be large enough to make the error disappear. In practice, 64 MB is enough for all but the most heavy-duty of tasks.

The functions.php file.

The functions.php file.

When you’re ready, save your file and upload it to the server again. Then, check whether the “413 Request Entity Too Large” error still exists. If it does, head onto the next method.

2. Modify Your WordPress .htaccess File

Much like your functions.php file, your .htaccess file sits on your server. The difference here is that .htaccess is a configuration file for Apache servers. If you’re a Kinsta customer, you’ll know we run Nginx servers, so you won’t see this file in your setup.

Still, for those with an Apache server, this is the approach you’ll need. Much like with the guidance for functions.php, first log into your server through SFTP, then look in your root folder as before.

The .htaccess file should be within this directory, but if it’s missing, we suggest you get in touch with your host to determine where it is, and whether your server runs on Nginx instead.

Once you’ve found it, open it up again. You’ll see some tags, and the most important here is # END WordPress. You’ll want to paste the following after this line:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

In short, this does almost the same thing as the code you’d add to the functions.php file, but it’s akin to giving the server direct instructions.

The .htaccess file.

The .htaccess file.

When you’ve finished, save your changes, upload the file, and check your site again. If you’re still having trouble, we’d again suggest contacting your host, as they will need to verify some aspects of your setup that lie beyond the scope of this article.

3. Change Your Nginx Server Configuration

Our final method is specific to Nginx servers — those used at Kinsta. The purpose is the same as when working with the .htaccess file, in that you’re talking to the server, rather than going through WordPress.

We mentioned that for Apache servers you’ll use .htaccess. For Nginx servers, though, you’ll want to find the nginx.conf file. Rather than walk you through every step in the chain, we’ve gone over the full details in our post on changing the WordPress maximum upload size.

Remember that you’ll need to also alter the php.ini file based on the changes you make to nginx.conf. We’ve covered that in the aforementioned blog post too, so take a look there for the exact steps.

Summary

Despite WordPress being a rock-solid platform, you’ll see a lot of different WordPress errors over time. The “413 Request Entity Too Large” error is related to your server, though — not WordPress. As such, there’s a different approach to solving this error than other platform-specific issues.

If you have SFTP skills, there’s no reason you can’t fix this error quickly. It relates to the upload size specified in your server configuration files, so digging into your .htaccess or nginx.config files will be necessary. It’s a breeze to crack open your text editor and make the changes to these files, and if you’re a Kinsta customer, we’re on hand to support you through the process.

This brief tutorial shows students and new users steps to resolve a common error with WordPress when trying to upload files, media, and other data and get shown an error that says “413 Request Entity Too Large” via Nginx.

This error, 413 request entity too large occurs when you try to upload or make a client request that is too large to be processed by the web server, in the case of an Nginx HTTP server.

If the server setting has a request size limit that is too small, your users/clients may come across this error a lot. So you will probably want to adjust the web server settings to allow larger requests.

One of the common issues webmasters encounter when managing WordPress is allowing the server to allow file upload via the WordPress media library.

WordPress allows users to upload new themes and plugin files, however, if your Nginx-powered website isn’t configured to allow the large file to be uploaded, the upload process will fail always.

Some common errors users get when dealing with file uploads with WordPress are:

  • Http error attempting to upload media
  • the uploaded file exceeds the upload_max_filesize directive in php.ini
  • maximum execution time exceeded
  • allowed memory size exhausted and many more.

Before continuing with the steps below, please back up your system.

Configure WordPress directory permissions

First, make sure the directory WordPress is running in has the correct permission for the Nginx web server to operate. On Ubuntu systems, the root directory is almost always at /var/www/html.

So, run the commands below to give Nginx web server full access to that directory.

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Adjust PHP-FPM settings

Next, adjust PHP-FPM settings to allow larger file uploads. By default, PHP-FPM is only allowed to upload a certain file size, so there’s a limit. Adjust the file upload size limit and other directives in PHP-FPM.

On Ubuntu 18.04 and up, the default PHP-FPM configuration file is stored in the file below:

/etc/php/7.x/fpm/php.ini

The x in the line above can either be a 0 or 1, 2, 3 or 4

So, open the PHP-FPM configuration file by running the commands below and adjusting the settings to suit your environment.

sudo nano /etc/php/7.2/fpm/php.ini

Then scroll down the file line by line and adjust each directive with the value below:

memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 100M
file_uploads = On
max_execution_time = 600
max_input_time = 600

Save your changes.

If the file size you’re uploading is greater than 100MB, then adjust the upload_max_filesize to be greater than the file size.

Adjust Nginx configurations

Nginx also has limited definitions.

If you don’t define the size limit in the Nginx configuration, whatever you do in the PHP configuration file may not apply to Nginx. To allow Nginx to also upload a larger file, open Nginx configuration and add the values as defined below:

On Ubuntu systems, Nginx default site configuration files are stored at /etc/Nginx/sites-available/default

If you have a custom file in there, adjust the highlighted values also.

server {
    listen 80;
    listen [::]:80;
    root /var/www/html/wordpress;
    index index.php index.html index.htm;
    server_name example.com www.example.com;

    client_max_body_size 100M;

location / {
    try_files $uri $uri/ /index.php?$query_string;
   }

location ~ .php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      fastcgi_connect_timeout 300s;
      fastcgi_read_timeout 300s;
      fastcgi_send_timeout 300s;
  }
}

Save the file and continue

Finally, restart Nginx and PHP-FPM for the new settings to take effect

sudo systemctl reload nginx.service
sudo systemctl reload php7.2-fpm.service

Now go and try to upload the file you want with a size smaller than 100MB

This should do it.

Sometimes, a website shows annoying errors confusing users while browsing. If browsing other sites makes you annoyed when it comes to your site, things are very different. Many types of website errors occur, some generic and others specific to WordPress. One such error is 413.

Error 413 belongs to the family of HTTP 4xx status codes, which identify errors connected to the request made by the client. In this article, you will see what the “413 Request Entity Too Large” error is and how you can fix it in your WordPress.

  • What Is the “Error 413 Request Entity Too Large” Error?
  • Why Does “413 Request Entity Too Large” Error Occur?
  • Fixing the “413 Request Entity Too Large” Error in WordPress

HTTP Error 413 indicates that the request made cannot be managed by the server, and this is because it involves a file or a block of data or, again, a group of files that are too large compared to the maximum limit that the server can manage.

The browser window generally displays the message “413 Request Entity Too Large”. This problem can occur if you try to upload too large files via the browser, exceeding the limits imposed by the webmaster for security reasons or others.

Why Does the “413 Request Entity Too Large” Error Occur?

Error 413 Request Entity Too Large occurs when you try to upload a file that exceeds the maximum upload limit set on your web server. In other words, when you try to upload a file that is too large, the web server returns an error message informing the user that “413 Request Entity Too Large”.

The message shown to the user may vary depending on the web server and the client. The following are the most common messages that indicate the occurrence of this error:

  • Error 413
  • HTTP Error 413
  • HTTP Code: 413
  • Request Entity Too Large
  • 413. That’s an error.

Fixing the “413 Request Entity Too Large” Error in WordPress

As you know, error 413 usually occurs when you upload a large file to your web server, and your hosting provider has set a limitation on file size.

One of the common problems webmasters encounter when managing WordPress is allowing the webserver to allow file uploads via the Media Library. However, if your Nginx-powered website is not configured to allow the uploading of large files, the upload process will mostly fail.

I will show you some of the easiest methods to increase the file upload size and fix the 413 Request Entity Too Large error in WordPress.

  1. Reset File Permissions
  2. Manually Upload the File via FTP
  3. Increase Upload File Size
  4. Modify Your Functions.php File
  5. Modify Your .htaccess File
  6. Modify Your nginx.conf File
  7. Contact Your Hosting Provider

1. Reset File Permissions

It might be possible that you are encountering this error due to limited access to a file and upload permission. So, it would be great to check the WordPress file/folder permissions and set the recommended permission, then try uploading the file to your site.

You can set the permissions from an FTP Client like FileZilla, and if your hosting provider offers any file permission reset option, then you can fix it from there.

reset file permission to fix 413

2. Manually Upload the File via FTP

It’s a good idea to consider FTP to upload your large file, but please note that if you are uploading a file via FileZilla, it takes more time.

Here, you will need to access your web server and upload the file by drag and drop. Therefore, first, you need to check whether your hosting provider offers server credentials or SFTP access to your web server.

server credentials

Now, you need the FileZilla FTP Client to access your web files, so download it if you don’t have one. Then, open FileZilla and fill the respective fields; Host, Username, Password, and Port. You can see in the below screenshot that I pasted my server IP, Username, Password, and 22 as a port number.

connect filezilla

Next, drag the file you want to upload to your website from your local desktop (left-side) and drop it into your web server’s folder. In my case, the webserver folder path is /applications/dbname/public_html/wp-content/uploads. If you want to upload any plugin then the folder path is /applications/dbname/public_html/wp-content/plugins.

3. Increase Upload File Size

Many good WordPress hosting providers offer the file size settings feature on their platform that lets users increase the maximum upload size value, maximum execution time, post max size, and more.

Now, let’s look at how you can increase your upload file size from the hosting dashboard. Cloudways offers application and server settings from which you can increase your file upload settings. From the Application Management panel, I have to remove comment “;” from three values and increase the upload and post max size to 256M & execution time to 300.

php_admin_value[post_max_size] = 256M

php_admin_value[upload_max_filesize] = 256M

php_admin_value[max_execution_time] = 300

setting file upload size from hosting panel

To check whether the file size value is updated or not, you need to create an info.php file on your desktop and upload it to your website folder via FileZilla. Now, open any file editor like Notebook, paste the following code, and save it as info.php.

<?php

phpinfo();

?>

info.php

Now, upload it to your site’s public_html folder.

upload info.php file

In the next step, open your browser and run this URL “www.yoursite.com/info.php”. In my case, the URL is https://wordpress-675386-2363839.cloudwaysapps.com/info.php. Search for the PHP admin values that you updated; if the values are changed, you have successfully increased the file size. After this, try to upload your file and check whether the issue has been resolved or not.

info.php on browser

If your hosting provider doesn’t offer any feature to modify the file upload size, move to the next method.

4. Modify Your Functions.php File

You can edit your theme’s functions.php file and increase the file upload size. But before that, you will need to create a backup of your entire WordPress site for data recovery. Backups help you recover your web files if something goes wrong.

You need an FTP Client like FileZilla to access your site’s file. So, connect your server via FileZilla and go to your active theme folder. You will find the theme files in the wp-content folder and in my case, the source path is “/applications/enxybqgzgy/public_html/wp-content/themes/twentynineteen”. Next, find the functions.php and click View/Edit.

edit functions.php file

Next, paste the following lines of code into your file and save it. This will define the max upload size in Megabytes. Replace the numbers as per your requirement.

@ini_set( 'upload_max_size' , '256M' );

@ini_set( 'post_max_size', '256M');

@ini_set( 'max_execution_time', '300' );

After this, check open info.php on your browser “www.yoursite.com/info.php” and check whether the values are updated or not, then try uploading your file.

In case this doesn’t work, then move to the next method.

5. Modify Your .htaccess File

If your website is hosted on LAMP Stack (using Apache web server and PHP), you can increase the max upload size from your .htaccess file.

Again, you need to access your .htaccess file from an FTP client like FileZilla and go to the public_html folder. Search for the .htaccess file, and if you do not see the .htaccess file, it’s probably hidden. Hence, navigate to FileZilla menus > Server and click Force Showing Hidden Files.

view hidden files

Now View/Edit the .htaccess file in a code editor or Notepad and add the following lines.

php_value post_max_size 256M

php_value memory_limit 256M

php_value max_execution_time 300

Choose a number and size that is suitable for your site and file. Next, open info.php ““www.yoursite.com/infor.php”” on your browser to check the updated sizes as we did in the previous step.

6. Modify Your nginx.conf File

The above troubleshooting method is for Apache web server, but if you are running your website on LEMP (NGINX as a web server and PHP), you need to edit nginx.conf i.e., located in /etc/nginx/ and add the following line of code to the file.

http {

client_max_body_size 100M;

}

7. Contact Your Hosting Provider

If you tried all the above and are still facing the issues, then it would be good to contact your hosting support and ask them to fix this issue ASAP. Several hosting providers offer 24/7 support chat and ticket assistance to help their customers.

Summary

Error 413 Request Entity Too Large is related to the size of the client request. There are multiple ways to fix this error you have read in this article. The most common way is to reduce the file size or to change the web server settings to increase the upload file size. If you know any other methods that can help fix the HTTP 413 Error, then please comment in the section below.

Frequently Asked Questions

Q. How do I fix Error 413 Request Entity Too Large?

A. The most common way to fix the HTTP 413 Error is to increase the media file maximum upload size. Other ways are: resetting file permissions, uploading files using an FTP client, and modifying your files (fuctions.php/.htaccess/nginx.config).

Q. What does “HTTP Error 413” mean?

A. If a user gets this error it is because he’s uploading a file that is too large. When a webmaster receives this report, what he can do is ask the user to reduce the file size and try to upload it again.

Are you seeing the ‘413 Request Entity Too Large’ error in WordPress?

This error usually occurs when you are trying to upload a theme or plugin file in WordPress. It means that the file is larger than the allowed maximum file upload limit on your website.

In this article, we will show you how to easily fix the ‘413: Request Entity Too Large’ error in WordPress.

WordPress 413 error - Request entity too large

What Causes WordPress 413 Request Entity Too Large Error?

This error usually happens when you are trying to upload a file that exceeds the maximum file upload limit on your WordPress website.

Your web server will fail to upload the file, and you will see the ‘413 Request Entity Too Large’ error message.

413 request entity too large error example

Normally, most WordPress hosting companies have their servers configured so that WordPress users can easily upload large images and other media.

However, sometimes this setting is not high enough to upload large theme or plugin files.

The server configuration can also stop you from uploading large files to the media library. In this case, you will see a different message clearly stating that the file size exceeds the maximum allowed limit.

File size exceeds maximum upload size limit

That being said, let’s take a look at how to fix the WordPress ‘413 Request Entity Too Large’ error.

Fixing 413 Request Entity Too Large Error in WordPress

There are multiple ways to fix the request entity too large error in WordPress. We will cover all these methods, and you can try the one that works best for you.

You can use the quick links below to jump to the method you want to use.

  • Method 1: Increase Upload File Size Limit Using WPCode (Recommended)
  • Method 2: Increase Upload File Size Limit via .htaccess File
  • Method 3: Manually Upload File via FTP

Method 1: Increase Upload File Size Limit Using WPCode (Recommended)

You could directly edit your theme’s functions.php file. However, we recommend against this method because even small mistakes can break your website.

That’s why we recommend using WPCode instead. It is the best WordPress code snippets plugin that allows you to increase the upload file size limit without directly editing the functions.php file.

First, you will need to install and activate the free WPCode plugin. For more details, see our guide on how to install a WordPress plugin.

Next, you need to go to Code Snippets » Add New Snippet in your WordPress admin sidebar. Then, simply click the ‘Add New’ button.

Click the Add New Button to Add Your First Custom Code Snippet in WPCode

Now you will see a library of different code snippets.

You need to click on ‘Add Your Custom Code (New Snippet)’.

Adding a custom code snippet to WordPress

You can enter a title for the code snippet at the top so that you can find it easily.

You now need to enter the following code into the ‘Code Preview’ box.

@ini_set( 'upload_max_size' , '120M' );
@ini_set( 'post_max_size', '120M');
@ini_set( 'max_execution_time', '300' );

Make sure that you also select ‘PHP Snippet’ from the ‘Code Type’ dropdown menu.

Increase file upload size with WPCode snippet

You can increase the values in upload_max_size and post_max_size to be more than the file you are trying to upload.

You will also need to increase the max_execution_time to the time you think it would take for the file to upload. If you are unsure, then you can try doubling this value.

Finally, make sure to toggle the code snippet from ‘Inactive’ to ‘Active’ at the top of the page and click on ‘Save Snippet’. This will execute the code snippet on your website.

Switch the code snippet to Active and click Update in WPCode

For more details, please see our guide on how to easily add custom code in WordPress.

Method 2: Increase Upload File Size Limit via .htaccess File

For this method, you will need to access and edit your .htaccess file using an FTP client or the file manager app in your hosting dashboard.

For more details, see our guide on how to use FTP in WordPress.

Then, simply add the following code at the bottom of the .htaccess file:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

You can change each of the numerical values to be more than the size of the file you are trying to upload. Then, make sure to save and reupload the .htaccess file to your server.

To learn more about increasing the file upload size limit, see our guide on how to increase the maximum file upload size in WordPress.

Method 3: Manually Upload File via FTP

If the 413 error only occurs when you are uploading one specific file, then you may want to consider uploading it manually via FTP.

If you are trying to upload a WordPress theme, then see our guide on how to install a WordPress theme and jump to the ‘Installing a WordPress theme using FTP’ section.

If you are trying to upload a plugin, then see our guide on how to install a WordPress plugin and jump to the ‘Manually install a WordPress plugin using FTP’ section.

For other files, you can see our guide on how to manually upload WordPress files using FTP.

We hope this article helped you learn how to fix the WordPress ‘413 Request Entity Too Large’ error. You may also want to see our list of the most common WordPress errors and how to fix them, along with our expert picks for the must have WordPress plugins to grow your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience building WordPress websites. We have been creating WordPress tutorials since 2009, and WPBeginner has become the largest free WordPress resource site in the industry.

Понравилась статья? Поделить с друзьями:
  • Как найти товар для продающего сайта
  • Как составить предложение с выражением день за днем
  • Как найти устройство find my device
  • Как найти инструменты азоту в игре сталкере
  • Как найти семейства ревит