
If you’re dealing with large file uploads, complex forms, or REST APIs, you’ve probably run into frustrating PHP limits. One of the most important settings that controls how much data your PHP application can handle is post_max_size. This directive in your PHP configuration determines the maximum size of POST data that your server will accept, including file uploads and form submissions.
In this in-depth, step-by-step guide, we’ll explain what post_max_size is, why it matters, and how you can set or increase it properly. Whether you’re running a self-managed server, using cPanel, or managing your cloud server with ServerAvatar, we’ve got you covered.
What is post_max_size in PHP?
The post_max_size directive in PHP defines the maximum amount of data that can be sent via POST methods. This includes data sent from forms, file uploads, or APIs.
- The default value is usually 8M (8 megabytes).
- If your application tries to send more than this, PHP will discard the POST data and return an error.
So, if you’re getting errors like “POST content-length exceeds the limit”, increasing post_max_size might solve your problem.
Why Increasing post_max_size is Important
Here are some common scenarios where you might need to increase this limit:
- Uploading large files through web forms
- Sending large payloads to an API endpoint
- Handling complex forms with many fields
- WordPress media uploads failing
- Laravel, Magento, or other PHP apps rejecting large requests
Without the right settings, users will face errors, and your application could become unreliable.
The Relationship Between post_max_size and upload_max_filesize
It’s important to know that post_max_size works together with upload_max_filesize.
- upload_max_filesize controls the maximum size of an individual file.
- post_max_size controls the total size of the request, including all files and fields.
Tip: post_max_size should always be equal to or greater than upload_max_filesize
Example:
upload_max_filesize = 50M
post_max_size = 60M
Methods to Set or Increase post_max_size in PHP
There are multiple ways to change the post_max_size value depending on how your server is configured.
Let’s look at them one by one.
Method 1:- Using ServerAvatar (Quick and Easy for Managed Servers)
What is ServerAvatar
ServerAvatar is a powerful and easy-to-use cloud server management panel that helps you manage your PHP-based websites and applications like WordPress, Laravel, Magento, and more — without needing advanced server knowledge.
If you’re using ServerAvatar to manage your cloud server, you don’t need to touch any code or open a terminal to change your PHP settings. You can do it directly from the dashboard in just a few simple steps — even if you’re not a developer.
Here’s how to increase post_max_size and upload_max_filesize using ServerAvatar:
Step-by-Step Guide:
- Login to Your ServerAvatar Account
Login to ServerAvatar Dashboard and Select Your Server - Open Your Application
From the left-side menu, click on “Applications”.

Go to PHP Settings
- After selecting the app, a menu will appear on the left.
- Click on “PHP Settings”.
- This section allows you to change important PHP configurations like memory, post size, file size, and more.
Find the Fields for post_max_size and upload_max_filesize
- You will see a list of PHP options with editable fields.
- Locate:
- post_max_size
- upload_max_filesize
Set New Values

For example:
After that, update the value of post_max_size to 100M and upload_max_filesize to 80M, or adjust them based on your specific requirements.
This means your application will now be able to handle a total POST request size of up to 100MB and allow individual file uploads of up to 80MB.
Click “Save Changes”
- After entering the values, scroll down and click the “Save Changes” button.
- ServerAvatar will automatically restart the PHP service in the background to apply the new configuration — no need to restart manually!
Why This Method is Best
- No command line needed – perfect for beginners.
- Takes less than 2 minutes.
- Works great for any PHP-based application like WordPress, Laravel, Magento, or custom PHP projects.
- Safe and secure, as ServerAvatar handles all restarts and file updates internally.

Method 2:- Using php.ini (Recommended for Self-Managed Servers)
The php.ini file is the main configuration file for PHP. If you manage your own server, this is the most direct way to increase post_max_size.
Step-by-Step Guide:
- Find the php.ini File
- Open your terminal and run one of these commands to find the location of your PHP configuration:
php --ini
or
sudo nano /etc/php/8.1/apache2/php.ini
3. Open php.ini in a Text Editor
Once you find the file path, open it using a text editor. For example:
sudo nano /etc/php/8.1/apache2/php.ini
4. Search for post_max_size
5. In the editor, press Ctrl + W and type:
post_max_size
6. Change its value to the size you want. Example:
post_max_size = 100M
7. Update upload_max_filesize Too
Make sure to set this as well:
upload_max_filesize = 80M
8. Restart Your Web Server
After making changes, you must restart the web server for the new settings to apply
If you’re using Apache:
sudo systemctl restart apache2
If you’re using Nginx with PHP-FPM:
sudo systemctl restart php8.1-fpm
Conclusion
Setting the correct post_max_size value in PHP is crucial for applications that handle large file uploads or form submissions. Whether you’re managing your server manually or using a powerful management panel like ServerAvatar, configuring this directive properly ensures a smoother experience for your users and fewer errors on your site.
Always remember to adjust related settings like upload_max_filesize, memory_limit, and Nginx’s client_max_body_size for the configuration to work seamlessly.
FAQs
1. What happens if post_max_size is smaller than upload_max_filesize?
The upload will fail, and users may receive incomplete POST data or an empty file on upload.
2. Do I need to restart my server after changing post_max_size?
Yes, if you’re editing php.ini, a server restart is needed. With ServerAvatar, the restart is handled automatically.
3. Is there a maximum limit for post_max_size?
Technically, it depends on your server’s memory and PHP build. However, values above 512M are uncommon and risky.
4. How can I change post_max_size without access to php.ini?
You can use .htaccess, .user.ini, or ServerAvatar’s PHP Settings panel depending on your hosting type.
5. Why use ServerAvatar for managing PHP settings?
ServerAvatar provides a clean dashboard, no need for SSH or code edits, making server management safer and faster—perfect for developers and agencies.