PHP Settings

PHP Settings

Changing your PHP settings can fix a number of issues with your website and we've made making those changes in the platform simple.

Here are a few of the more common PHP variables with links to the different articles on how to change them:

memory_limit

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server, but can result in blank pages displaying, errors on the site or in the Admin area and entries in the error log files like this:

Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /path/to/php/script

short_open_tag

short_open_tag is a bit of an 'old school' PHP setting, and was used a lot in PHP versions up to and including PHP 5.6. It is a is a deprecated feature of PHP now and it is highly recommended to use the full tag combination instead (i.e. ). The directive is still available for you to use for backwards compatibility. Errors like the below would indicate that short tags are in use:

PHP message: PHP Parse error: syntax error, unexpected end of file, expecting else if (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)

max_execution_time

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser which helps prevent scripts from tying up the server. The default setting is 30 and setting a different max_execution_time can help if you're seeing an fatal error on your site when trying to install/update a plugin or maybe upload a file.

max_input_time

max_input_time sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. Although you can change this within the PHP Configuration section in the Platform, we would suggest changing the max_execution_time instead. We have a guide on how to change the max_execution_time here.

display_errors

display_errors determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user. By default this is turned off, but could be a very useful tool if you're troubleshooting why a site isn't loading correctly.

error_reporting

error_reporting defines which errors are reported in the web application and the default value is E_ALL. Prior to PHP 8.0.0, the default value was: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED. This means diagnostics of level E_NOTICE, E_STRICT and E_DEPRECATED were not shown. There are a number of different settings for this variable and you can change it in the Platform.

open_basedir

open_basedir limits the files that can be accessed by PHP to the specified directory-tree, including the file itself. When a script tries to access the filesystem, for example using include, or fopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to access it and the site will not load (there are various error messages you may get but a 500 error is common). By default all websites are restricted to their own site files and tmp location.

session.gc_maxlifetime

session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up.

disable_functions

disable_functions allows you to disable certain functions. It takes on a comma-delimited list of function names. These directives were used commonly to disable potentially unsafe functions from being used even if a malicious actor gets code-execution access in a server.

max_input_vars

The PHP Max Input Vars is the maximum number of variables your server can use for a single function to avoid overloads. The default value of max_input_vars is 1000 but you can change this in the Platform. Increasing max_input_vars may helps in resolving issues with your menus. If they're not saving or being truncated, then increasing this value may resolve the issue.