1. Home
  2. Technical
  3. Changing the php.ini configuration file using .user.ini

Changing the php.ini configuration file using .user.ini

Creating and modifying the .user.ini file

You can change the PHP configuration with a .user.ini file (NB! The filename starts with a dot).

By default, the .user.ini file doesn’t exist on the server and it can be added to the root directory of the needed (sub)domain on the server and will affect all subdirectories within it.

The changes in .user.ini will apply to both HTTP and HTTPS host.

NB! .user.ini can be used for PHP_INI_PERDIR, PHP_INI_USER and PHP_INI_ALL settings – for PHP_INI_SYSTEM settings (i.e. opcache parameters) the global php.ini still must be used. You can find the list of php.ini directives here: http://php.net/manual/en/ini.list.php


Here are some examples of common PHP settings to change. Only the desired settings need to be added to the file.

Max execution time

By default, the maximum execution time for PHP scripts is set to 30 seconds. Changing it to 10 minutes (600 seconds) looks like this:

max_execution_time = 600

PHP Memory limit

By default, the memory limit is set to 1024M. To increase it to 1500M, add the following line:

memory_limit = 1500M

Changing a NewRelic application name

newrelic.appname = "My app"

Display errors

By default, displaying PHP errors is turned on and to turn them off, add the following line. You can use display_errors to turn on/off displaying PHP errors and to turn them off, add the following line:

display_errors = off
Updated on 21. May 2024

Was this article helpful?

Related Articles