GoAdmio

maxexecutiontime

Read or set PHP max_execution_time across all php.ini files (default 600 seconds)

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/maxexecutiontime sets PHP's max_execution_time (the longest a script may run, in seconds) in the php.ini file of every installed PHP version at once. It:

The command does not reload PHP. New values take effect only after PHP-FPM (or Apache) is reloaded. See Applying the change.


Quick start

# Set the default (600 seconds) in every php.ini
/go/maxexecutiontime

# Reload PHP so the new value is used
/go/fpm

Syntax

/go/maxexecutiontime [seconds]
/go/maxexecutiontime return
Form Behavior
/go/maxexecutiontime Sets max_execution_time = 600 in every php.ini file.
/go/maxexecutiontime <seconds> Sets that value in every php.ini file.
/go/maxexecutiontime return Prints the current value and changes nothing. The word is not case-sensitive.

If the first argument starts with -- (for example --force), it is ignored and 600 is set.


Options

This command has no options. It takes one optional argument.

Argument Required Default Notes
<seconds> No 600 A whole number of seconds. 0 means no limit. Nothing checks the value (see Validation).
return No — Prints the current value instead of setting one.

Output

Outcome What you get
Value set Max Execution Time updated successfully.
return The number from the first php.ini found. Blank if that file has no max_execution_time 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.

Every run is also recorded in /var/log/go/maxexecutiontime.log.

[!NOTE] return ends with exit status 1, and a normal update ends with 0. In scripts, read the output instead of relying on the exit status.


Examples

# Use the default of 600 seconds
/go/maxexecutiontime
# Allow scripts to run for 5 minutes
/go/maxexecutiontime 300
# Remove the limit (use with care)
/go/maxexecutiontime 0
# Show the current value
/go/maxexecutiontime return
# Set a value and apply it
/go/maxexecutiontime 120 && /go/fpm

Troubleshooting

Symptom Likely cause Fix
The old value still shows in phpinfo() PHP has not been reloaded. Run fpm or reload.
Scripts still stop earlier than the new value The web server, a proxy, or Cloudflare cuts the request first. On most Cloudflare plans, a proxied request is cut off after about 100 seconds. Raise the web server timeout, or run long jobs from the command line or a background job.
A site still uses a different value A setting for that site (for example in its PHP-FPM pool, a .user.ini file, or the application itself) can override php.ini. Change it where it is set.
return prints nothing The first php.ini has no uncommented max_execution_time line. Run /go/maxexecutiontime <seconds> to add it.
return shows a different value than one version uses return reports only the first php.ini file found. Open the other versions' php.ini files to compare.
Unknown operating system. The operating system name in /usr/local/goadmio/linux/os.db isn't one the script knows. The script supports AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, and Ubuntu.
Permission denied The command was not run as root. Adding a missing line writes to the file without sudo. Run it as root.
PHP reports a syntax error in php.ini after a change A non-numeric value, or several words, was passed and written as is. Run /go/maxexecutiontime <seconds> again with one number, or use checkphpini.
Success message, but no file changed No php.ini files exist at the expected paths. Check the paths in Files it changes.

Details

Files it changes

The script reads the operating system from /usr/local/goadmio/linux/os.db. Only files that exist are changed.

Operating system Files
AlmaLinux, Rocky, CentOS, Red Hat, Fedora /etc/php.ini, and /etc/opt/remi/<version>/php.ini for each version found
Debian, Ubuntu /etc/php.ini, and for each version in /etc/php/: <version>/fpm/php.ini, <version>/cli/php.ini, and <version>/apache2/php.ini

How a value is written

For each php.ini file:

Situation Result
An uncommented max_execution_time = line exists Every such line is replaced with max_execution_time = <value>.
The setting is missing, or only exists as a comment (;max_execution_time = 30) A new max_execution_time = <value> line is added at the end of the file.

If the file's last line has no trailing newline, the added line may be joined to it. Check the file if PHP reports an error after the change.

Validation

The command does not check the value. Everything after the command name is written as typed, so 300 600 or abc ends up in php.ini as is. Pass a single whole number.

Applying the change

What it does not change


See also

Command Description
maxinputtime Read or set PHP max_input_time across all php.ini files
memorylimit Change the PHP memory limit for all PHP versions
uploadmaxfilesize Read or set PHP upload_max_filesize across all php.ini files
checkphpini Scan every php.ini on the server for startup errors and delete the line that causes each one
fpm Restart all installed PHP-FPM versions on your server
reload Reload PHP-FPM and the active web server
multiphp Change the PHP version of one domain or all domains, or list the installed PHP versions