PHP Error – post content length exceeds the limit

Home Forums BulletProof Security Pro PHP Error – post content length exceeds the limit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #272
    AITpro Admin
    Keymaster

    Email Question:

    Hi,
    for custom php.ini on 1and1 : put the new php.ini in all folder (admin,content,includes) …and it’s work 🙂

    I’ve a new problem that i understand please see the attachment below :

    not very clear for me…my site offer greeting image to purchase for download and in my post i put 2 zip file (the secure file to download)
    it seem sometime file are too large ! suscriber on my site never upload file…how to obtain the true post content lengh for administrator only ?

    thank for your greta support !
    olivier

    Post Content Length Exceeds the Limit

    Answer:

    In general when you see PHP Errors in your BPS Pro php error log you just need to Google them to find out what the problem and solution are.  Please see this BPS Pro PHP Error Help post regarding php errors and the BPS Pro php error log >>>  https://www.ait-pro.com/aitpro-blog/3576/bulletproof-security-pro/custom-php-ini-faq/#php-errors  In this case after i Googled the php error this error is caused by a file being uploaded that is larger than the allow file upload limit.  Please see this StackOverflow post that i found in my Google search for this php error >>> https://stackoverflow.com/questions/6279897/post-content-length-exceeds-the-limit

    So what you will need to do is edit your custom php.ini file and set the maximum file upload limit that you want by changing both of these custom php.ini settings.

    upload_max_filesize = 100M
    post_max_size = 100M

    Thanks

    #278
    apparence
    Member

    yes i’d look google for these questions and try to find solutions via some links… My problem is that custom php.ini are not working : i’d try to follow all 1and1  instructions step by step.Create a phpini.pho to make php.ini in all folders.It’s ok in all folder. But my custom phi.ini values are always not included when i look for php info :

    ;memory_limit = 90M
    ;post_max_size = 64M stay on 8MB
    ;upload_max_filesize = 32M stay on 20M
    ;file_uploads = On

    what about this ; before value ?
    Thanks !

    #279
    AITpro Admin
    Keymaster

    These 2 directives work together and need to be the same setting and then you would uncomment them by removing the semi-colon.

    post_max_size = 64M
    upload_max_filesize = 64M

    If you click on the Php.ini File Creator Blue Read Me help button you will find the help information below.  In your case since your Host (1and1) only allows Multiple custom php.ini files to be created per directory instead of the typical single custom php.ini file for your entire website then you will need to create a new Master php.ini file and make these edits below in your Master php.ini file so that you can then use your Master php.ini file to create all of your multiple php.ini files per directly again.

    Basically what you are doing is editing your Master php.ini file and uncommenting  these 4 directives below in your Master php.ini file (semi-colons in php.ini files mean commented out – so remove the semi-colons from in front of these 4 directives below).  These 4 directives below are near the top of your Master php.ini file.  Next you will then search for duplicates of these same 4 directives in your Master php.ini file and you will be commenting those out.  What this does is you will now have these 4 directives near the top of your new Master php.ini file and grouped together instead of being spread out all throughout your new Master php.ini file, which is what Host’s normally do with these directives.

    This is just a nice way for you to have these settings together for you at the top of your new Master php.ini file or you can of course leave them commented out and search through your Master php.ini file for these directives and change their settings wherever they are located by default in your Master php.ini file – this is totally up to you, but i prefer things grouped together that should be grouped together.  😉

    NOTE:  I believe the maximum memory limit setting allowed are these.  1&1 Starter an 1&1 Unlimited 60M.  For 1&1 Business the maximum memory limit is 80M.  You should contact your Host Support to double check this.  For now use the same memory limit setting that you see in your Master php.ini file or try 80M and see if 1&1 sends you an email about setting your memory limit higher than the allowed maximum for your Hosting account/website.

    memory_limit = 80M
    post_max_size = 100M
    upload_max_filesize = 100M
    file_uploads = On

    3. IMPORTANT!!! AND HIGHLY RECOMMENDED:There is only 1 manual editing step that is important and highly recommended. Every Web Host has its own individual maximum memory_limit setting that you can use for your website / Hosting Account. So what you will need to do is open your custom php.ini file with the php.ini File Editor and follow these instructions that you will find in your new custom php.ini file that you created:

    [Memory Limit and File Uploads – 64M is a good default for WordPress – your Host may allow you to increase this even more][IMPORTANT AND HIGHLY RECOMMENDED: That you manually edit this file and do the following steps below]

    [If your Host Server php.ini Type is SA or SA/CT and NOT just CT: Manually search through this file…][…and find these 4 duplicate directives below and comment them out by adding a semi-colon in front of them…][…and then uncomment these 4 directives by removing the semi-colon from in front of these 4 directives below…][…Find the maximum memory_limit that your Web Host allows and then add it below.]

    [If your Host Server php.ini Type is just CT and NOT SA/CT or SA: then uncomment these 4 directives below…][…Find the maximum memory_limit that your Web Host allows and then add it below.]

    ;memory_limit = 64M
    ;post_max_size = 20M
    ;upload_max_filesize = 20M
    ;file_uploads = On
    #290
    apparence
    Member

    hi, thanks for this great support ! ok, for 1and1 provider : uncomment these 4 lines… for your master php.ini and custom php.iniand it’s work ! >>Why BPS does not realize this action? For a non-programmer like me this is confusing ! save and put in your root…   here the script to automate the php.ini in all folder :

     <?php // set this value to Y if you only want to overwrite old php.ini files 
    // set this value to N if you want to put a php.ini file in every directory $overwriteOnly = "N";
    if ($overwriteOnly == "Y")
    echo "Operating in Overwrite Only Mode";
    $path = "/homepages/XX/XXXXXXXXXX/htdocs/";// or this path for sub folder :
    // $path = "/homepages/XX/XXXXXXXXXX/htdocs/your-folder/"; 
    $source = $path . "/php.ini";
    if (!file_exists($source)) die('Error - no source php.ini file'); 
    function search($dir) {   
    global $source;   global $overwriteOnly;  
    $dh = opendir($dir);   
    while (($filename = readdir($dh)) !== false) {     
    if ( $filename !== '.' AND $filename !== '..' AND $filename !== 'cgi-bin' AND is_dir("$dir/$filename") ) {       
    $path = $dir."/".$filename;        
    $target = $path . "/php.ini";     
    if (!file_exists($target) AND $overwriteOnly == "Y") {         
    echo "$path skipped - no php.ini file";  } else {        
    echo "$target;if (!copy($source,$target)) echo "Write failed for $target";
    if (file_exists($target)) chmod($target,0600);     
    }       
    search($path);     
    }   }   
    closedir($dh); 
    } search($path); echo "Done."; ?>

    thensave this at phpini.pho and put to your root, open this phpini.php to your adress in navigator like myname.com/myfolder/phpini.php and it generate all php ini in all folder ! Memory limit for 1and1 is no more than 80M, if you need more you must take a dedicaced solution… Turn off  auto restore before upload your php-ini by safe ftp or if you forget this, take a look at quarantine board and restore your file then refresh db log of quarantine. Wish this topic answers can help other users ! Olivier (Hello from France )

    #293
    AITpro Admin
    Keymaster

    Thanks for contributing this script for Hosts that require multiple per directory php.ini files.  😉

    Re:  Why does BPS not uncomment the 4 lines automatically?

    The php.ini Master File Maker grabs the entire contents of your Host’s Server Default php.ini file and then does str_replace and preg_replace functions to combine your Server’s Default php.ini file with a BPS php.ini template file and the end result is you have a new Master php.ini file with both php.ini files combined.  in that process of combining your Server’s default php.ini file – several duplicate php.ini directives in your Server’s Default php.ini are automatically commented out since these directives are included in the BPS php.ini template file.

    We decided to not automatically change these 4 directives for several reasons, but mostly to prevent user errors.  😉

    ;memory_limit = 64M
    ;post_max_size = 20M
    ;upload_max_filesize = 20M
    ;file_uploads = On
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.