Articles

How to Change PHP Settings

You can change PHP settings for your apps by creating a file named .user.ini in your app's web root directory.

apps/APPNAME/public/.user.ini

Using a .user.ini file is the best and safest way to customize PHP settings for an app. Unlike modifying global configuration files, using a .user.ini file can't break your server and does not require you to restart PHP.

Format of .user.ini Files

Each line in your .user.ini file should have the format:

key = value

For example, to disable the PHP memory_limit for your app, you'd add the following line to your .user.ini file:

memory_limit = -1

If you've used older hosting where you changed PHP settings through the Apache .htaccess file using the php_flag and php_value directives, you should forget those old habits now. Configuring PHP through .htaccess files does not work when PHP runs through FastCGI via PHP-FPM, such as when using ServerPilot.

Verify Changed Settings

To confirm your customizations to your app's .user.ini file are correct, you can create a PHP script that contains only the following line:

<?php phpinfo(); ?>

and then request that file through your browser. You should see the "Local value" for your modified setting showing the value you've set in your .user.ini file.


Last updated: May 23, 2017