๐Ÿ“
Hosting

.user.ini Configuration: Changing PHP Settings on Shared Hosting

25.01.2030
โ† All articles

.user.ini is a special file that lets you customize PHP settings per site on shared hosting. It works on PHP 5.3+. On shared hosting you can't modify the global php.ini (other clients share the server), but through .user.ini you can apply per-site overrides.

.user.ini location

The .user.ini file is placed in your site's root directory (usually public_html). This file applies to all PHP scripts in that directory and its subdirectories. If you need separate settings for multiple subdomains, place a dedicated .user.ini in each subdomain directory.

Syntax

The .user.ini file is plain text, one "parameter = value" per line:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120
max_input_vars = 3000
display_errors = Off
log_errors = On

Which parameters can be changed?

Through .user.ini you can change only "PHP_INI_PERDIR" and "PHP_INI_USER" category parameters. The most commonly used in this category:

memory_limit, upload_max_filesize, post_max_size, max_execution_time, max_input_time, max_input_vars, display_errors, log_errors, error_log, date.timezone, default_charset, mbstring.internal_encoding, session.save_path, session.cookie_lifetime, file_uploads, allow_url_fopen, expose_php.

Other parameters (e.g., disable_functions, open_basedir) are in the "PHP_INI_SYSTEM" category and can only be changed via php.ini โ€” .user.ini won't accept them.

Caching

.user.ini changes don't take effect immediately โ€” PHP re-reads it about every 5 minutes (user_ini.cache_ttl parameter). To test changes right away, restart the PHP-FPM or Apache service, or wait 5 minutes.

Sayt.uz practice

23% of Sayt.uz clients use .user.ini โ€” mostly for WordPress large media uploads, e-commerce import scripts, or custom debug. The most-set parameters: upload_max_filesize 128M (for images and video), memory_limit 512M, max_execution_time 300 (for import operations). Tip: in production keep display_errors = Off but log_errors = On โ€” errors don't show to visitors but are saved for your debugging.

Related articles

๐Ÿ’ฐ Hosting Price Comparison: Uzbek and International Providers ๐Ÿ“ก Server Monitoring Tools: Prometheus, Grafana, Datadog, and More ๐ŸŒ Edge Computing Hosting: Moving Compute Closer to Users ๐Ÿข Colocation Server: Placing Your Own Hardware in a Data Center
๐ŸŒ Language
๐Ÿ‡บ๐Ÿ‡ฟ O'zbek ๐Ÿ‡บ๐Ÿ‡ฟ ะŽะทะฑะตะบ ๐Ÿ‡ท๐Ÿ‡บ ะ ัƒััะบะธะน ๐Ÿ‡ฌ๐Ÿ‡ง English โœ“