Follow @endyourif rss Facebook LinkedIn

Apache 413 request entity too large error Apache 413 request entity too large error

Published on Jul 31, 2022

Apache 413 request entity too large error

Ugh, I've been stuck on this one for a file and finally found my solution, so I thought I would definitely share it with you. So you're coming here because you've received the dreaded 413 Request Entity too Large error. Keep reading because I have your solution!

You can set the maximum size of Apache servers through the files: .htaccess.

This error is very specific to Apach servers; however, I've also got the solution with: Nginx 413 Request Entity Too Large Error

Modify .htaccess

If your website has been built on a Apache server, the maximum limit on your server can be increased using the above steps:

  1. On your server use your favorite text editor, e.g. nano .htaccess
  2. Locate the following field: upload_max_filesize and adjust it to the amount of space required when uploading a file
  3. Similar to above, find the field labelled: post_max_size and adjust it
  4. Save the changes
  5. Restart Apache webserver

Here is an example of editing your .htaccess file setting both of these values:

php_value upload_max_filesize 4M
php_value post_max_size 5M

In the above example, I've randomly chosen 4 for the php_value upload_max_filesize and 5 for php_value post_max_size, but you can set this higher or lower based on your needs.

To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, to set a file upload limit of 20 megabytes, you could set the upload_max_filesize directive to 20M, and the post_max_size directive to 21M.

If this doesn't help try Nodejs 413 request entity too large error

Modify via the GUI

If you your web server has a GUI: Choose File Manager on your browser's menus so we can start the same process above of modifying the .htaccess file.

  1. Click File. Locate the root directory of your webserver e.g. (public_html). htaccess
  2. In some cases if the configurations are different, this is caused by the .htaccess is not accessible on the server
  3. Once you've found the file, Choose .Htaccess and press Edit button
  4. Copy & paste link to your computer
  5. Find and edit the two files mentioned above: upload_max_filesize and post_max_size
  6. Select Save and upload file
  7. And finally, restart your Apache webserver

Reference: Official Apache Source Documentation

Tags: PHP | Apache

About Jamie Munro

Welcome to my blog. I have been compiling articles since 2009! Below is a list of every post I've ever created. Some of my major focuses have been compiling the best source of jQuery tutorials on the Internet today. A recent focus of mine is now focusing on creating the best SQL Tutorials for Beginners, Intermediate and Advanced Users. This is a compiliation of all my experience about how to do common SQL commands to optimize for performance. As you might see from the links around here, I've also written and published 5 books. My first and last book are focused around ASP.NET MVC and Web API tutorials. The last book has a big focus on integrating Knockout.js as the MVVM for the front-end code. O'Reilly Media was so interested in Knockout.js that they actually commissioned me to write that book first as it is one of the only books dedicated entirely to this MVVM library. So if you're looking for the best Knockout.js tutorials, I've compiled the best list. My first book, even though it was self published, was on the PHP framework: CakePHP. I used this framework for years and many of my first ever exampes were all focused on CakePHP tutorials that provide so many fantastic PHP examples. There are so many Javascript tutorials out there, but I noticed that one of the things I work on most with Javascript is arrays. With this I've worked hard on compiling a big list of really advanced Javascript array examples. These array examples are amazing including how to group by, get distinct array elements and so many more. I've also dabbled a little bit with Node.js and during those experiments I definitely ran into some common errors like Can't set headers after they are sent, Solving No Access-Control-Allow-Origin with Node js and Express, and Uncaught ReferenceError: require is not defined. With these common errors I've compiled a list of Node.js tutorials that help solve these problems, but more importantly getting you started with the basics.