On ruachost.com, you can override PHP configuration settings on a per‑directory basis using .user.ini files. This is useful when different applications in your account require different PHP settings.

 

Why Use .user.ini Files?

  • Apply custom PHP directives without changing global server settings.

  • Configure settings for specific applications or directories.

  • Useful for managing multiple apps with different requirements (e.g., CMS vs. custom scripts).

 

How .user.ini Works

  • A .user.ini file is similar to php.ini, but applies only to the directory where it is placed and its subdirectories.

  • PHP reads .user.ini files every few minutes (default: 300 seconds).

  • Directives inside .user.ini override global settings for that directory.

 

Steps to Create a .user.ini File

Step 1: Create the File

  1. Log in via FTP, SFTP, or File Manager.

  2. Navigate to the directory where you want custom settings.

  3. Create a file named:

    .user.ini
    

Step 2: Add PHP Directives

Insert the settings you want to override. For example:

display_errors = On
memory_limit = 256M
upload_max_filesize = 20M

Step 3: Save and Upload

  • Save the file in the target directory.

  • The settings will apply to scripts in that directory and subdirectories.

 

Example Use Case

If you have two applications with different requirements:

  • App A needs error reporting enabled.

  • App B requires higher memory limits.

You can place separate .user.ini files in each application’s directory with the appropriate directives.

Important Notes

  • Always include the leading period (.) in the filename.

  • Not all PHP directives can be overridden in .user.ini.

  • Changes may take a few minutes to take effect due to PHP’s caching interval.

  • Use phpinfo() to confirm that your settings are applied.

Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)

Powered by WHMCompleteSolution