"Well-tuned PHP settings remove a surprising amount of friction from WordPress. It's the cheapest performance win that many site owners simply overlook."

Memory limits

WordPress and many plugins require sufficient memory. The two key directives are memory_limit and max_input_vars.

memory_limit

Set this to the highest value your Hostinger plan allows. On shared WordPress hosting, 256M or 512M is typical. For small VPS deployments, 512M to 1G is a comfortable baseline.

; Recommended
memory_limit = 256M   ; or 512M on larger plans

max_input_vars

WordPress menus, theme options, and plugin settings can use hundreds of input variables. Increase from the default 1000 to 5000 or 10000 to avoid truncation issues.

max_input_vars = 5000

Practical note

If you see "Allowed memory size exhausted" errors in your logs, bump memory_limit up by 128M increments until the errors stop. Monitor RAM usage to ensure you're not oversubscribing on a shared plan.

Execution settings

These control how long PHP scripts are allowed to run.

max_execution_time

Default is often 30 seconds. For WordPress imports, large plugin operations, or complex page builds, increase to 60 or 120 seconds.

max_execution_time = 60

max_input_time

Time allowed to parse input data. Set equal to or slightly less than max_execution_time.

max_input_time = 60

max_input_nesting_level

If you encounter "Nesting level too deep" errors, increase this (default 64). Set to 128 if needed.

max_input_nesting_level = 128

OPcache & bytecode caching

OPcache stores compiled PHP code in shared memory, drastically reducing CPU load.

Enable OPcache

It is usually enabled by default on Hostinger. Verify by checking opcache.enable=1.

Recommended OPcache settings

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
opcache.validate_timestamps=1
opcache.fast_shutdown=1

Tip

On high-traffic sites where code changes are infrequent, set opcache.revalidate_freq=0 and manually reset the cache after updates. For most sites, a value of 2 seconds is fine.

Upload settings

WordPress needs adequate limits for media uploads and plugin/theme installations.

upload_max_filesize

Set this to the largest file you expect to upload—usually 64M or 128M.

upload_max_filesize = 64M

post_max_size

Must be at least as large as upload_max_filesize. Set slightly higher to account for form data.

post_max_size = 68M

max_file_uploads

Number of files that can be uploaded at once. Default 20 is fine; increase if needed.

max_file_uploads = 20

Realpath cache

PHP caches resolved file system paths. WordPress with many plugins can benefit from a larger cache.

realpath_cache_size = 4096K
realpath_cache_ttl = 600

This reduces disk I/O repeatedly resolving the same paths. On small VPS, ensure you have enough free RAM for the cache.

Common pitfalls

  • Over-allocating memory — Setting memory_limit higher than your plan's available RAM can cause the entire PHP process to be killed by the OOM killer. Stay within safe margins.
  • Conflicting INI sources — Changes in .user.ini may be overridden by the main php.ini or the Hostinger PHP INI Editor. Use one source of truth and verify with phpinfo().

  • Forgetting to restart PHP — On VPS, after editing php.ini, you must restart php-fpm or Apache for changes to take effect. On shared hosting, changes apply automatically after a minute or two; force a refresh by restarting PHP in hPanel if needed.
  • Disabling OPcache to speed up edits — Some tutorials suggest turning off OPcache during development. That's fine locally, but never disable it in production—the performance cost is substantial.
  • Setting opcache.revalidate_freq=0 — This forces PHP to check file timestamps on every request, eliminating OPcache benefits. Use a small positive value (1-2) or manually reset after deployments.

Warning

After making changes, monitor your site's error logs for a few days. Misconfigured PHP settings can cause timeouts, crashes, or silent failures that degrade user experience.

Verify your changes

  1. Check effective values: Create a temporary file phpinfo.php with <?php phpinfo(); ?> and load it in your browser. Search for each directive to confirm it's set as intended.
  2. Monitor error logs: In Hostinger hPanel, view the PHP error log for warnings or fatal errors after applying changes.
  3. Test WordPress admin and front-end: Browse a few pages, upload a media file, and run a plugin operation to ensure stability.
  4. Delete phpinfo file: Immediately remove phpinfo.php after verification—it reveals sensitive configuration details.