Changing the PHP post_max_size limit with CloudLinux in DirectAdmin

post_max_size limits the size of the entire HTTP POST body received by PHP. It includes submitted form fields and uploaded files together. When the request exceeds this limit, an application can receive empty POST and file data even though the visitor selected a file.

Prepare for the change

Identify whether the failed operation is a form submission, multi-file upload or import. Measure the total request rather than only its largest file. Keep the current value and check hosting storage, memory and application restrictions before making changes.

01 Change the setting

  1. In DirectAdmin, open the appropriate user account and domain, then search for Select PHP Version. In Evolution it may appear under Extra Features. Open the CloudLinux selector, not an unrelated server administration page.
  2. Check the active PHP version and which websites the selector change will affect. DirectAdmin can expose both its native PHP selection and CloudLinux PHP Selector. The selected domain in DirectAdmin does not by itself prove that an Alt-PHP change is isolated to that domain. Check the selector scope before applying an account-wide change.
  3. Open Options and locate post_max_size. Record the current setting.
  4. Choose a value larger than upload_max_filesize and large enough for the expected complete request, within the limits offered by your hosting service. Save the change.
  5. Submit a representative test request and verify every expected field and attachment. If there are many small fields, investigate max_input_vars separately because it limits the number of parsed input variables.

02 Example: two files in one form submission

Suppose a permitted form uploads two files of about 20 MiB each. Neither file exceeds an illustrative upload_max_filesize of 32M, but the complete request exceeds 40 MiB once form fields and multipart overhead are included. A post_max_size of 32M would therefore be too small.

If your plan and application allow it, 64M is an example request allowance with room for this particular test. It is not a Nabtech plan entitlement or a universal recommendation. Set approved values through the active selector, then confirm that both attachments and every required form field arrived. Retain separate application limits and check proxy restrictions if PHP never receives the request.

Confirm the expected result

Confirm the effective setting in the web application and check the server log for the test submission. A correct result includes all expected fields and files; a success banner alone can conceal missing form values in poorly validated applications.

What should I check when a larger post_max_size does not resolve the request failure?

A larger POST limit does not change reverse proxy limits, timeouts or an application's import rules. Avoid using unlimited values to work around an unidentified failure. If the request succeeds partially, reduce its size and examine the application's validation before processing live orders or customer records.

  • 0 Users Found This Useful
  • control-panels, development
Was this answer helpful?

Related Articles

Changing the PHP version with CloudLinux in DirectAdmin

A PHP version change can make an application compatible with current dependencies and security...

Managing PHP extensions with CloudLinux in DirectAdmin

Extensions add capabilities such as database access, multibyte text handling, image processing...

Configuring allow_url_fopen with CloudLinux in DirectAdmin

allow_url_fopen controls whether PHP file functions can use supported URL wrappers, such as...

Configuring PHP error display and logging with CloudLinux in DirectAdmin

PHP errors are useful for diagnosis, but displaying them on a public site can expose filesystem...

Adjusting the PHP memory limit with CloudLinux in DirectAdmin

memory_limit limits memory available to an individual PHP script. Increasing it can help a...