HTTP 413 Request Entity too Large - http

I am currently unable to post very large files using the Drupal FileField Source (remote url option) on a custom file field in drupal 7 (7.15). The file is uploading to the tmp directory successfully but failing when it attempts to post. The file size is 870Mb (A 510mb file has posted successfully.).
I receive the following error in access_log:
83.000.15.200 - - [02/Oct/2012:12:30:14 +0000] "POST /file/ajax/field_video_source/und/0/form-i6gTPc5LlZsQxKpgO43eaLGjh7dgWqHjQ6TPZD9SRmY HTTP/1.1" 500 413
I assume I am interpreting this error correctly as a 413 Request Entity Too Large
I have configured php.ini with the following settings:
post_max_size = 1800M
max_execution_time = 3600 (i know that's overkill)
memory_limit = 1750M
max_input_time = -1 (unlimited)
In addition I have attempted to set the LimitRequestBody value to 0 in php.conf using the following:
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 0
</Files>
This didn't appear to help.
The server is running Centos 6.3, Apache/2.2.15, PHP 5.3.3 with 2GB Ram and 40GB disk.
I can't believe it should be struggling with that size file (~800mb) and those server settings?

Do you have access to the http.conf if so you could try this.
This has been the issue for me sometimes to upload with over 500mb. Although I strongly suggest you should try and get it working with
the setting SecRequestBodyAccess "On".
I had to edit the Apache config file (http.conf) and change
SecRequestBodyAccess On
to
SecRequestBodyAccess Off
EDIT:
IF i remember correctly you could try the following.
SET
SecRequestBodyNoFilesLimit , the maximum value is 1073741824 (1Gb)

Related

Unable to install jetpack on my wordpress website

When trying to install jetpack on my wordpress website, I receive this message: The Jetpack server was unable to communicate with your site http://xx[IXR -32300: transport error: http_request_failed cURL error 28: Connection timed out after 10001 milliseconds]
What can I do to solve the issue?
Most of the time it's because of low resources on cheap shared hostings. Either navigate to your server C-panel / PHP options (on GoDaddy they are inside of "Select PHP version") and increase the following:
memory_limit
upload_max_size
post_max_size
upload_max_filesize
max_execution_time max_input_time
If this doesn't work or you don't have access to PHP options then contact your hosting provider and ask them to do it.

Wordpress gives 500 error on search results on different server

Background
We have developed a WordPress website on a staging server with a custom theme and a custom search.php to display the results. This worked like a charm with no errors or warnings in the log.
When the website was put on a different environment (Windows VM), the search results would give a 500 error.
What have we've tried
Since the search works on the staging and not on the live server, we have compared the server specs and PHP installs. These are results from a site check on the live server
Server architecture: Windows NT 10.0 AMD64
Web server: Microsoft-IIS/10.0
PHP version: 7.2.18 (Supports 64bit values)
PHP SAPI: cgi-fcgi
PHP max input variables: 1000
PHP time limit: 300
PHP memory limit: 256M
Max input time: 60
Upload max filesize: 20M
PHP post max size: 8M
cURL version: 7.64.0 OpenSSL/1.1.1b
Is SUHOSIN installed?: No
Is the Imagick library available?: No
This is the staging server:
Server architecture: Linux 4.19.8-x86_64-linode120 x86_64
Web server: nginx/1.13.6
PHP version: 7.3.2 (Supports 64bit values)
PHP SAPI: fpm-fcgi
PHP max input variables: 3000
PHP time limit: 120
PHP memory limit: 256M
Max input time: 60
Upload max filesize: 64M
PHP post max size: 64M
cURL version: 7.60.0 OpenSSL/1.0.1e
Is SUHOSIN installed?: No
Is the Imagick library available?: Yes
.htaccess rules Custom rules have been added to your .htaccess file.
The PHP version is recently set to 7.3 on the staging server for testing purposes. I have also checked if all required PHP components are installed on the live server, and that's the case.
Question
What do you suggest I try next? PHP version 7.2 or 7.3 doesn't seem to be the issue, the big difference I see is that maybe it's not working because it's on a Windows server, but the rest of the website works fine.
The error is found. I've used short PHP opening '' at one point and that wasn't configured on the new server in the php.ini.

Phabricator: setup local-disk upload limit?

I'm going to upload files in Phabricator according to this manual. But I find there's a limit 8M for local-disk storage engine in "$your_site/applications/view/PhabricatorFilesApplication/" .
I've already set client_max_body_size 64M in vhost server block for nginx.
Also, post_max_size = 64M, upload_max_filezie = 64M for php.
Then, restart nginx, php-fpm service.
But Phabricator still prints out
No configured storage engine can store this file. See "Configuring File Storage" in the documentation for information on configuring storage engines.
when I upload a file which size exceeds 8M.
Also, there's no storage.local-disk.max-size configuration key.
How can I custom local-disk upload limit?
Phabricator 535c1a5, libphutil aa6cd8f
None of the engines support more than 8MB. Larger files are stored by chunking them client-side and uploading the chunks (the chunk size is currently 4MB).
Apparently, chunking only works with drag-and-drop - try that instead of using the file upload form.
According to the guideline: https://secure.phabricator.com/book/phabricator/article/configuring_file_storage/
After configure nginx and php, you need enable Engine: MySQL and Engine: Local Disk:
First of all go to the phabricator directory which you clone from https://github.com/phacility/phabricator.git
1. Engine: MySQL
phabricator/ $ ./bin/config set storage.mysql-engine.max-size 8388608
2. Engine: Local Disk
phabricator/ $ ./bin/config set storage.local-disk.path /path/to/store/phabricator/files

Alternate max_post_size and upload_max_filesize for different subdomains and/or directories php.ini nginx fastcgi php-fpm

I have nginx and php5-fpm working wonderfully, and www.mysite.com, this.mysite.com, and that.mysite.com all go to different directories elegantly. I have been working on a site for uploading files. I'd like the maximum file size to be 10 GB. For this to work, I have to tell php.ini that max_post_size and upload_max_filesize are 10240 MB instead of the default 2 MB.
I am well aware of the security implications. I would therefore like those php.ini values of 10240 MB to apply ONLY to one or both of:
upload.mysite.com
and/or
www.mysite.com/upload
One option is to also install Apache to listen on a different port, do some redirect/rewrite magic, and have mod_php's php.ini file with the 10240 MB values handle only the uploads site. I'd prefer to not do that.
WITHOUT having a separate web server handle requests to my upload page, how can I accomplish this in a single instance of nginx?
Use client_max_body_size and set it to the desired value in your server blocks. Nginx will directly drop the handling of the request if the request body exceeds the size specified in this directive. Please note that you won't get any POST submitted in that case.
With php-fpm you can have several pools running, one for each website.
Then you can alter any php.ini setting inside the pool configuration (but be carefull, you cannot use MB or G shortcuts), using this syntax inside the pool:
; UPLOAD
php_admin_flag[file_uploads] =1
php_admin_value[upload_tmp_dir]="/some/path/var/tmp"
;Maximum allowed size for uploaded files. 10240MB *1024 *1024 -> 10737418240
php_value[upload_max_filesize] ="10737418240"
php_admin_value[max_input_time] = (...)
php_admin_value[post_max_size] (...)
This is really near the available syntax for Apache virtualhosts. PHP configuration has never been stuck in php.ini files.
As you can see you can use php_value or php_admin_value, the big difference is that when using php_value the setting can later be altered by the application, using ini_set command. So you could use a low value for upload_max_filesize and alter it in the application only on the upload script.

PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment:
Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
I changed the upload_max_filesize from 2M to 1000M, but that didn't seem to do anything.
Any ideas?
8388608 bytes is 8M, the default limit in PHP. Update your post_max_size in php.ini to a larger value.
upload_max_filesize sets the max file size that a user can upload while
post_max_size sets the maximum amount of data that can be sent via a POST in a form.
So you can set upload_max_filesize to 1 meg, which will mean that the biggest single file a user can upload is 1 megabyte, but they could upload 5 of them at once if the post_max_size was set to 5.
Changes will take effect after a restart of the server.
Just set these in php.ini:
upload_max_filesize = 1000M;
post_max_size = 1000M;
1. First u will find the php.ini file.
u can find php.ini file from this path. C:\xampp\php or from
xampp folder.
2. Now open php.ini file and change the following:
1. post-max-size (change 8M to 800M).
2. upload-max-filesize (change 2M to 2000M).
3. Now stop the Apache server and MySQL.
4. Now restart Apache server and MySQL.
It worked fine after that.
Enjoy ur working now :)
That's an 8MB post_max_size error.
Set it to a value you're comfortable with.
You will have to change the value of
post-max-size
upload-max-filesize
both of which you will find in php.ini
Restarting your server will help it start working. On a local test server running XAMIP, i had to stop the Apache server and restart it. It worked fine after that.
Already restarted your Webserver?
This will force php to reload the php.ini
Go to C:\xamppp\php. Set these values in php.ini:
upload_max_filesize = 1000M
post_max_size = 0M
Create new text file in your wp-admin directory root and name it info.php.
Open info.php and add this line:
<?php phpinfo(); ?>
Save it.
Go to yourwebsitename(probably localhost)/wp-admin/info.php in any web-browser.
On the 8th line you will see: Configuration File (php.ini) Path, in my case it is C:\Windows, meaning it is located on my C drive.
In the 9th line you will see: Loaded Configuration File, and next to it is written C:\xampp\php.ini
So I found my php.ini page that is associated with my wordpress web-site.
Go to that path, and find php.ini.
Open it, and edit:
Search for post_max_size=8M, and change it to post_max_size=1000M
Search for upload_max_filesize=2M, and change it to upload_max_filesize=1000M
Go back to your Admin page → Media → Add New
On the bottom you will see that 2MB has changed to 1000M.
Once you done this process then you must restart your web server or just restart your computer.
Find php.ini [\xampp\php]
Just set these in php.ini:
upload_max_filesize = 1000M;
post_max_size = 1000M;
Rebot server
Stop Apache and MySQL
Start again Apache and MySQL
Go to
C:\drive\xampp(where xampp installed)
simply find php.ini file then in the file search
post_max_size=XXM
upload_max_size=XXM
Change with this code
post_max_size=100M
upload_max_filesize=100M
Don't forget to restart the xampp
Using wamp do the following and hopefully, it will resolve an issue
Make these changes in PHP Options to correct:
max_execution_time 180
memory_limit 512M or your highest available
post_max_size 32M
upload_max_filesize 64M
You also need the change post-max-size.
From the XAMPP panel, click on the ADMIN button on the Apache site.
Then choose to edit php.ini
And add the missing post_max_size to a value you are comfortable with.
post_max_size = 100M
Go to
C:\ drive
or that drive where xampp is installed
click on xampp
find php and open it , there you find php.ini folder
open php.ini file with notepad and find upload_max_filesize and post_max_size in both "up and down find option",change both values to 1000M
I have fixed same issue by changing below parameters to expected value in /etc/php/7.2/apache2/php.ini file
upload_max_filesize = 8M;
post_max_size = 8M;
upload_max_filesize = 8M;
post_max_size = 8M;
Imagine you already changed above values. But what happen when user try to upload large files greater than 8M ?
This is what happen, PHP shows this warning!
Warning: POST Content-Length of x bytes exceeds the limit of y bytes in Unknown on line 0
you can avoid it by adding
ob_get_contents();
ob_end_clean();
You have 2 options for this error:
The file you are uploading is too big, which you need to use smaller file.
Increase the upload size in php.ini to
upload_max_filesize = 9M; post_max_size = 9M;
Go to browser and search for php.ini and then open it, and change these two values:
post_max_size= 1000000000000M
upload_max_filesize= 10000000000000M
If you open the php.ini file using notepad , you can search for these two values by clicking:
cmd + f
You might not be uploading the right zip file. In my case, as a newbie to wordpress(I used to do hardcoding), I installed the zipped file that contained another zip file which is the actual theme neede to be upload. So what what need to do in this case is to unzip the file and locate the "theme_name.zip" inside.
If changing the post_max_size settings from XAMPP folders. It did not work for you try this.
From XAMPP control panel, click config then PHP (php.ini) and edit post_max_size and upload_max_filesize to a higher number in this file instead. Stop Apache server. Start Apache server. This worked for me.
If your objective is to import a theme into your Wordpress then you can manually copy paste your theme into your wp-content->themes folder and extract it of course. I just encountered this and couldn't locate the php.ini file for WAMP.
I have solved my php7 issues on centos 7 by updating /etc/php.ini with these settings:
post_max_size = 500M
upload_max_filesize = 500M
for anyone running PHPMyAdmin inside of docker.
Set the UPLOAD_LIMIT value in the env
from the docs https://github.com/phpmyadmin/docker#environment-variables-summary
UPLOAD_LIMIT - if set, this option will override the default value
for apache and php-fpm (format as [0-9+](K,M,G) default value is
2048K, this will change upload_max_filesize and post_max_size
values)
docker-compose.yml example:
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
- UPLOAD_LIMIT=300M
normal docker run:
sudo docker run .... -e UPLOAD_LIMIT=300M
For both of these options you have to rebuild the container
As Optimaz ID pointed out, the code below helped me hide the PHP error message in a case where the user uploads a file larger than the upload_max_filesize and post_max_size set in php.ini (which is almost impossible when a large value is set).
ob_get_contents();
ob_end_clean();

Resources