/go/memorylimit sets PHP's memory_limit in the php.ini file of every installed PHP version at once. This is the most memory a single PHP script may use while it runs. The command: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Set a limit of 512 MB per script in every php.ini
/go/memorylimit 512M
The new value is live about a minute later.
Options
This command has no options. It takes one optional argument.
| Argument | Required | Default | Notes |
|---|---|---|---|
<value> |
No | -1 |
A size with a unit, or -1. Nothing checks the value (see Validation). |
return |
No | — | Prints the current value instead of setting one. |
Accepted size formats:
| Value | Meaning |
|---|---|
256M |
256 megabytes |
1G |
1 gigabyte |
-1 |
No limit |
512 |
512 bytes. A number without K, M, or G is a number of bytes, so every PHP script will fail. Always add the unit. |
PHP’s own default is 128M.
Examples
# Allow 256 MB per script
/go/memorylimit 256M
# Allow 1 GB per script
/go/memorylimit 1G
# Remove the limit (use with care)
/go/memorylimit -1
# Show the current value
/go/memorylimit return
# Apply the change immediately instead of waiting for the scheduled reload
/go/memorylimit 512M && /go/fpm
Output
| Outcome | What you get |
|---|---|
| Value set | Memory Limit updated successfully. |
return |
The value from the first php.ini found. Blank if that file has no memory_limit line. |
| Unsupported operating system | Unknown operating system. Nothing is changed. |
The success message is printed even if no php.ini file was found, so it does not prove that anything changed. Check with return.
The scheduled reload prints nothing. Every run is also recorded in /var/log/go/memorylimit.log.
[!NOTE]
returnends with exit status1, andreturndoes not schedule a reload. In scripts, read the output instead of relying on the exit status.
See the full reference at /go/memorylimit and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
