postmaxsize
Show or set PHP's
post_max_size(the largest POST request body PHP accepts) in every php.ini on the server, then reload PHP-FPM
- Command:
/go/postmaxsize - Category: PHP settings
- Required option: None
- Output: Plain text
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
post_max_size limits the total size of the data PHP will accept in one POST request. It includes form fields and file uploads, so it caps how large an upload can be, no matter how high upload_max_filesize is.
/go/postmaxsize changes this setting for the whole server in one step. It:
- finds every php.ini for every installed PHP version (FPM, CLI, and Apache, depending on the OS)
- sets
post_max_sizein each file, or adds the line if it is missing - schedules a PHP-FPM reload one minute later so the new value takes effect
- can instead just print the current value (
returnmode)
The default value, when you pass none, is 64M.
Quick start
# Set post_max_size to 64M (the default) in every php.ini
/go/postmaxsize
# Set it to 128M
/go/postmaxsize 128M
# Print the current value
/go/postmaxsize return
Syntax
/go/postmaxsize [<value>]
/go/postmaxsize return
| Form | Behavior |
|---|---|
/go/postmaxsize |
Sets post_max_size = 64M everywhere. |
/go/postmaxsize <value> |
Sets post_max_size to <value> everywhere. |
/go/postmaxsize return |
Prints the current value and changes nothing. Case-insensitive. |
The command takes no named options. Everything after the command name is treated as the value, so pass a single value such as 128M.
[!WARNING] Any first argument that starts with
--(for example--help) is not treated as an option. It is ignored and the value 64M is written to every php.ini.
Options
There are no --option flags. The only arguments are:
| Argument | Required | Default | Notes |
|---|---|---|---|
<value> |
No | 64M |
Written exactly as given. See valid values. |
return |
No | — | Read-only mode. Must be the first argument. |
Valid values
The script does not validate the value. It writes whatever you type, so use a form PHP understands:
| Form | Meaning |
|---|---|
8M, 64M, 128M |
Megabytes. |
1G |
Gigabytes. |
512K |
Kilobytes. |
67108864 |
Plain bytes. |
0 |
No limit. Not recommended on a shared server. |
A value containing / or & can break the sed replacement and corrupt the line. A value with spaces (such as 128 M) is written as-is and is not valid PHP.
Output
| Outcome | What you get |
|---|---|
| Value set | Post Max Size updated successfully. |
return mode |
The current value only, for example 64M. |
| Unsupported OS | Unknown operating system. Nothing is changed. |
Notes on the output:
- The success message is printed even if no php.ini files were found, so it does not prove a file changed. Check with
/go/postmaxsize return. returnmode exits with status 1, even though it succeeds. Do not use it afterset -eor in an&&chain. Capture it with command substitution instead:
current=$(/go/postmaxsize return)
- Every run, including
return, is logged with a timestamp and its arguments to/var/log/go/postmaxsize.log.
Examples
# Allow uploads of up to about 256 MB (raise upload_max_filesize too)
/go/postmaxsize 256M
/go/uploadmaxfilesize 256M
# Check the current value
/go/postmaxsize return
# Reset to the GoAdmio default
/go/postmaxsize
# Apply the change right away instead of waiting a minute
/go/postmaxsize 128M && /go/fpm reload
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Uploads still fail after the change | upload_max_filesize, memory_limit, or a web server or proxy limit is lower. |
Raise uploadmaxfilesize to match, and check the web server's body-size limit. |
| Value didn't change on the site | PHP-FPM hasn't reloaded yet. | Wait a minute, or run fpm or reload. |
Sites using Apache with mod_php still show the old value |
The script only schedules a PHP-FPM reload. | Reload the web server with web or reload. |
return prints nothing |
No php.ini was found, or the post_max_size line is indented or commented out. |
Check the file paths in Details, or run the command without return to write a clean line. |
Unknown operating system. |
The OS in /usr/local/goadmio/linux/os.db is not supported. |
Supported: AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, Ubuntu. |
--help changed the setting |
Arguments starting with -- fall back to 64M. |
Run /go/postmaxsize <old value> to set it back. |
| A php.ini now contains a broken value | An invalid value was written. | Run the command again with a valid value, then checkphpini. |
| Script exits with an error when run as a normal user | Appending a missing line to a php.ini needs root. | Run it as root, or with sudo. |
Details
Files that are checked
The script builds a list of php.ini files from the installed PHP versions. Files that do not exist are skipped.
| OS | Files |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini and /etc/opt/remi/<version>/php.ini for each installed version |
| Debian, Ubuntu | /etc/php.ini and, for each version in /etc/php/, fpm/php.ini, cli/php.ini, and apache2/php.ini |
How the value is changed
| Situation in a php.ini | Result |
|---|---|
An active post_max_size = ... line exists (leading spaces allowed) |
The line is replaced with post_max_size = <value>. |
| The line is missing | post_max_size = <value> is appended at the end of the file. |
Only a commented line (;post_max_size = ...) exists |
The commented line is left alone and a new active line is appended. |
No backup of the php.ini is made.
Return mode
return reads the first post_max_size line from the first php.ini that exists (normally /etc/php.ini), strips quotes and semicolons, prints it, and exits. It does not compare values across versions, so different PHP versions could have different values without it showing.
The reload
After a change, the script checks the at queue for a pending /go/ job containing fpm reload. If none exists, it schedules:
/go/fpm reload
to run one minute later. Running the command several times in a row therefore results in only one reload. This needs the at service to be installed and running.
flowchart TD
A["postmaxsize ..."] --> B["Log the call"]
B --> C{"Supported OS?"}
C -- "No" --> X["Unknown operating system, exit"]
C -- "Yes" --> D["Build list of php.ini files"]
D --> E{"First argument is return?"}
E -- "Yes" --> F["Print current value, exit 1"]
E -- "No" --> G{"Value given?"}
G -- "No or starts with --" --> H["Value = 64M"]
G -- "Yes" --> I["Value = arguments"]
H --> J["Replace or append post_max_size in each file"]
I --> J
J --> K["Print success message"]
K --> L["Schedule fpm reload in 1 minute if none queued"]
Good practice
- Keep
post_max_sizeat least as large asupload_max_filesize. If it is smaller, uploads fail even when the upload limit looks high enough. - Use a limit that fits your sites. A very large or unlimited value lets a single request use a lot of memory and bandwidth.
- This setting is server-wide. It applies to every account and every PHP version.
See also
| Command | Description |
|---|---|
uploadmaxfilesize |
Read or set PHP upload_max_filesize across all php.ini files |
memorylimit |
Change the PHP memory limit for all PHP versions |
maxexecutiontime |
Change the max execution time for all PHP versions |
maxinputtime |
Read or set PHP max_input_time across all php.ini files |
maxinputvars |
Read or set PHP max_input_vars across all php.ini files |
maxfileuploads |
Read or set PHP max_file_uploads across all php.ini files |
fileuploads |
Read or set PHP file_uploads across all php.ini files |
checkphpini |
Scan every php.ini for startup errors and delete the line that causes each one |
fpm |
Restart all installed PHP-FPM versions |
reload |
Reload PHP-FPM and the active web server |