Request Entity Too Large PHP

前端 未结 6 902
眼角桃花
眼角桃花 2020-11-27 06:35

In one of my CakePHP site, I got this error.

Request Entity Too Large

I don\'t know what is the problem. I think the data that I am posting through form is t

相关标签:
6条回答
  • 2020-11-27 06:52

    Sometimes on shared hosting you can add your own php.ini file - just copy the relevant bits out of any default file (or google for one).

    It's not an error I've seen before - it may as Gordon says, be Apache.

    Don't be afraid to ask the hosting support team - I've always found them to be very helpful (I think they must get lonely), and often they will make config changes for you.

    It certainly isn't a CakePHP problem.

    0 讨论(0)
  • 2020-11-27 06:54

    post_max_size and upload_max_filesize are PHP.ini settings. You can set them either directly in PHP.ini or via ini_set. I don't know if this can be set with some Cake-internal tools as well.

    However, the error could also be caused by a set limit of the RequestBodyLength in Apache (assuming you are running under Apache).

    0 讨论(0)
  • 2020-11-27 07:06

    Another possible cause for the "413 request entity too large" error is mod-security. That was the cause for me.

    Looking into the site's Apache error log said:

    ModSecurity: Request body no files data length is larger than the configured limit (131072).. Deny with code (413)

    On my Ubuntu 14.04 the config file is here but this really depends on the system:

    /etc/modsecurity/modsecurity.conf

    There is the default value for SecRequestBodyNoFilesLimit (and possibly also SecRequestBodyInMemoryLimit).

    0 讨论(0)
  • 2020-11-27 07:06

    I think you need to set that in the PHP config file, php.ini. If you have a VPS / root level access, just up the size on that. If you don't (shared hosting), you can modify the php ini parameters at runtime. Note that ini_set() won't work here, because the PHP settings are loaded too late (after the file has been uploaded, the PHP script begins execution).

    You'll need to include the following in your htaccess file (on shared hosting):

    php_value post_max_size 104857600
    

    It's possible this won't work. Some googling around made it seem as though some shared hosts will lock down this setting, making it not over-rideable in htaccess (just in main server config). If that's the case, you'll need to move hosts.

    0 讨论(0)
  • 2020-11-27 07:08

    Definitely not CakePHP problem but here are the two settings you need to set in order to upload files properly:

    vim /etc/php5/php.ini (or wherever the .ini is located)
    

    And set:

    post_max_size="200M"
    upload_max_filesize="200M"
    

    Now the tricky part in case you are using HTTPS! you also need to configure one SSL.

    vim /etc/apache2/sites-available/<whatever>-443.conf
    

    And set the SSLRenegBufferSize

    <Directory /appdata/www/<whatever>/web>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
        SSLRenegBufferSize 201048600
    </Directory>
    
    0 讨论(0)
  • 2020-11-27 07:10

    I tried all of these answers and the only thing that worked for me was to tune up the SSL Buffer Size. You can set this by...

    <Directory /my/blah/blah>
    ...
      # Set this to something big big...
      SSLRenegBufferSize 10486000
    ...
    </Directory>
    

    ...and then just restart Apache to take effect. (Found this at: http://forum.joomla.org/viewtopic.php?p=2085574)

    0 讨论(0)
提交回复
热议问题