This site contains affiliate links. If you purchase through them I may earn a commission at no extra cost to you. Full disclosure.

Archive / WordPress / Performance

Hostinger PHP Configuration Tips for WordPress Performance

The short answer: PHP settings have an outsized impact on WordPress speed and stability—especially memory limits, OPcache, and execution times. On Hostinger, you can safely tune these via the hPanel PHP INI Editor or a .user.ini file. Get the values right, and your site will feel snappier without upgrading hardware.

"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

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.

Frequently asked questions

How much memory should I allocate to PHP for WordPress?

WordPress itself recommends at least 64M, but for a smooth experience with a few plugins and a decent theme, 256M is a practical target. On Hostinger shared plans, set memory_limit to the maximum allowed (usually 256M or 512M). If you're on a VPS, 512M–1G is safe for small to medium sites.

Should I enable OPcache on Hostinger?

Yes. OPcache is almost always beneficial for WordPress. It stores compiled PHP bytecode in memory, reducing CPU load and speeding up page generation. On Hostinger, OPcache is typically enabled by default, but verify via phpinfo() or the PHP Configuration panel. If disabled, turn it on and set memory_consumption to 128M–256M.

What's the safest way to change PHP settings on Hostinger shared hosting?

Use the hPanel PHP Configuration > PHP INI Editor. Adjust only the settings you understand, click Apply, and wait a few minutes for changes to propagate. For granular control, add directives to a .user.ini file in your public_html (e.g., memory_limit=256M). Avoid editing global php.ini on shared hosting—it's not accessible.

Can increasing PHP limits fix the white screen of death?

Often, yes. A common cause of WSOD is PHP memory exhaustion. Increase memory_limit to 256M or higher. If that doesn't help, check error logs for syntax errors or plugin conflicts. Always increase limits gradually and test after each change.

How do I verify my PHP configuration changes took effect?

Create a phpinfo.php file in your web root with <?php phpinfo(); ?>, access it via browser, and search for the directives you changed. Remember to delete the file after checking—it exposes sensitive information. Alternatively, use WordPress plugins like 'PHP Info' or run wp-cli eval 'echo ini_get(\"memory_limit\");' if available.

Ready to optimize your WordPress site? Check out Hostinger's WordPress hosting plans and get your site running at peak performance.

Related reads