Custom PHP settings per directory with .user.ini files

Some hosting accounts use the PHP Selector instead of php.ini files to configure PHP settings. However, you can still specify custom PHP settings for a directory by using .user.ini files. This article explains how to set up and use .user.ini files on your account.
 

Using .user.ini files

When you create a .user.ini file, any PHP directives in the file are only active in that directory (and any subdirectories beneath it). This enables you to have different PHP settings for different directories. This may be necessary, for example, if you install two applications on your account that have different PHP requirements.

To enable custom settings in a .user.ini file, follow these steps:

  1. Use your preferred text editor to create a .user.ini file in the directory where you want to enable custom PHP settings.
    Make sure you include the leading period at the start of the filename: .user.ini
  2. In the .user.ini file, add the setting (or settings) that you want active in the directory. For example, to activate error reporting for scripts in the directory, add the following directive:
    display_errors=On
    For a list of directives you can use in PHP .ini files, please visit https://www.php.net/manual/en/ini.list.php.
  3. Save your changes to the .user.ini file. The new settings take effect immediately.

More Information

To view the official PHP documentation, please visit https://www.php.net/docs.php.

Get PHP Hosting

Article Details

  • Operating System: Linux Hosting
  • Level: Intermediate

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.