Once ticket is created, we offer assistance within 24 hours. We appreciate for your understanding.

Okay
  Print

How to Increase Post Max Size for Your Website

The Post Max Size setting determines the maximum size of POST data your website can handle. This includes form submissions, file uploads, and data sent during HTTP POST requests. If you're encountering issues like "POST content length exceeds the limit" or incomplete file uploads, you may need to increase this limit. Here's how you can do it.

What Is Post Max Size?

The post_max_size directive in PHP sets the maximum amount of data that can be sent in a single POST request. This value should always be equal to or larger than the upload_max_filesize to avoid upload issues.

Step 1: Check the Current Post Max Size

Before increasing the limit, determine the current post_max_size setting. You can check it using one of these methods:

A) Using PHP Info

  1. Create a file named phpinfo.php with the following code:
    <?php
    phpinfo();
    ?>
    
  2. Upload this file to your website's root directory.
  3. Open the file in your browser (e.g., http://yourwebsite.com/phpinfo.php).
  4. Look for post_max_size in the output.

B) Using Your Website Admin Panel

  1. Log in to your website’s admin panel.
  2. Navigate to System Info or Settings > Upload Settings.
  3. Look for the post_max_size value.

Step 2: Increase Post Max Size

Here are the methods to increase the post_max_size value, depending on your hosting environment.

A) Edit php.ini

  1. Access your server via FTP or your hosting control panel.
  2. Locate the php.ini file (commonly found in the root directory or /etc/).
  3. Open the file and add or modify the following line:
    post_max_size = 64M
    
  4. Save the file and restart your server.

B) Modify .htaccess (For Apache Servers)

  1. Open the .htaccess file located in your website’s root directory.
  2. Add the following line:
    php_value post_max_size 64M
    
  3. Save the file. The changes will take effect immediately.

C) Update Using cPanel or Hosting Dashboard

  1. Log in to your hosting provider’s control panel.
  2. Navigate to PHP Settings or MultiPHP INI Editor.
  3. Locate the post_max_size setting.
  4. Increase the value to 64M or higher.
  5. Save the changes.

D) Add to .user.ini (For Shared Hosting)

  1. If you’re on shared hosting, create or edit a .user.ini file in your website's root directory.
  2. Add the following line:
    post_max_size = 64M
    
  3. Save the file. Changes may take a few minutes to apply.

Step 3: Adjust Related Settings

To ensure smooth uploads and data processing, adjust these related settings in php.ini or .htaccess:

  • upload_max_filesize: Match or set slightly lower than post_max_size.
    upload_max_filesize = 64M
    
  • max_execution_time: Increase this to handle larger files or requests.
    max_execution_time = 300
    

Step 4: Verify the New Post Max Size

After making the changes:

  1. Refresh your website or clear the cache.
  2. Upload a file or submit a form to test if the new limit works.
  3. Recheck phpinfo.php or your admin panel to confirm the updated post_max_size value.

Troubleshooting Common Issues

  • Changes Not Applied: Ensure the correct configuration file (php.ini or .htaccess) is edited. Restart the server if required.
  • Shared Hosting Limits: Some hosting providers enforce strict limits. Contact your provider for assistance.
  • Configuration File Errors: Ensure there are no syntax errors in .htaccess or php.ini.

Best Practices

  • Set the post_max_size slightly higher than upload_max_filesize to account for metadata and additional data sent with files.
  • Avoid excessively high values to prevent server strain or misuse.
  • Monitor server logs to identify any upload or form submission issues.

Conclusion

Increasing the post max size is essential for websites handling larger uploads or form submissions. By following these steps, you can resolve upload errors and ensure your website operates smoothly. If you encounter issues, your hosting provider's support team is an excellent resource to guide you through the process.