How to Increase PHP Memory Limit in WordPress on Hostinger

by Fahim Mahmud Chisti

Seeing Fatal error: Allowed memory size of 134217728 bytes exhausted when you activate a plugin, run an import or save an Elementor page? That number is 128MB, and the fix is to increase the PHP memory limit for WordPress on Hostinger. This guide shows the hPanel setting, the matching wp-config.php lines and how to confirm the new limit is active.

Quick answer: Raise memory_limit in hPanel’s PHP Options, then let WordPress use it by setting WP_MEMORY_LIMIT in wp-config.php. Check the result in Site Health.

  1. In hPanel, open your site and go to Advanced > PHP Configuration > PHP Options.
  2. Set memory_limit to 256M or 512M and save.
  3. Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php above the “stop editing” line.
  4. Open Tools > Site Health > Info > Server and check the PHP memory limit row.
  5. Re-run the task that crashed.
In this guide
  1. Before You Start
  2. Why WordPress Hits Memory Limits on Hostinger
  3. Method 1: Change the PHP Memory Limit in hPanel
  4. Method 2: Set WP_MEMORY_LIMIT in wp-config.php
  5. Method 3: Set PHP Values in .htaccess (LiteSpeed)
  6. Method 4: Create or Edit .user.ini in public_html
  7. Check That the New Limit Is Active
  8. If the Memory Error Still Appears
  9. Frequently Asked Questions
  10. Next Steps
  11. Related guides on IsItDev
Close-up of a code editor showing PHP memory limit configuration settings

Before You Start

  • Access: your Hostinger hPanel login. Methods 2–4 also need hPanel File Manager or SFTP. The optional checks at the end use SSH.
  • Time: about 5–10 minutes.
  • Backup: download a copy of wp-config.php and .htaccess before you edit them. A typo in either file can take the site down with a blank page or a 500 error. Uploading the copy again undoes it.

Why WordPress Hits Memory Limits on Hostinger

WordPress runs on PHP, and every active theme, plugin, database query and image upload uses memory. By default, WordPress core asks for a baseline of 40MB on single sites and 64MB on multisite.

Hostinger sets a maximum PHP memory limit per plan. Its current documentation lists 1024MB and up for web hosting plans, and more for cloud. The value actually configured for your site can be lower than that maximum, and WordPress can never use more than PHP allows.

Two settings decide how much memory a request gets:

  • PHP memory_limit: the hard ceiling PHP enforces on every single request in your hosting account.
  • WP_MEMORY_LIMIT: the value WordPress asks PHP to raise its limit to on normal requests. A second constant, WP_MAX_MEMORY_LIMIT (256M by default), covers heavy admin tasks.

WordPress only ever raises PHP’s limit, never lowers it. If PHP already allows 512MB, a 40MB WP_MEMORY_LIMIT changes nothing. The reverse is where people get stuck: if you set 512MB in wp-config.php while the host caps your account lower, the host’s cap wins.

The error message tells you which ceiling you hit. Divide the byte figure by 1,048,576 to get megabytes: 134217728 bytes is 128MB, 268435456 bytes is 256MB.

Method 1: Change the PHP Memory Limit in hPanel

The quickest way to raise the server-level limit is Hostinger’s hPanel. It changes the PHP configuration for the site without touching a single file.

  1. Log in to hPanel, open Websites, and click Manage next to your site.
  2. Go to Advanced > PHP Configuration in the left sidebar.
  3. Click the PHP Options tab at the top.
  4. Find the memory limit setting (memory_limit).
  5. Enter or select your target limit (like 256M or 512M). Anything above your plan’s maximum is capped at that maximum.
  6. Click Save at the bottom.

You don’t need to restart anything yourself. Give it a minute, then check the new value as shown in “Check That the New Limit Is Active” below.

Method 2: Set WP_MEMORY_LIMIT in wp-config.php

Raising the limit in hPanel is usually enough on its own. Defining the WordPress constants as well makes WordPress request that memory explicitly on both the front end and the admin dashboard. This helps when PHP’s configured limit is lower than a task needs.

Open hPanel File Manager or connect over SFTP, then open wp-config.php in your site’s public_html folder.

Add these two lines right above the comment that says /* That's all, stop editing! Happy publishing. */:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

WP_MEMORY_LIMIT covers normal visitor traffic. WP_MAX_MEMORY_LIMIT gives extra room for admin jobs like resizing images, running plugin updates or processing batch data. For the exact syntax rules, see the WordPress wp-config.php documentation.

Save the file and reload any admin page. If it loads normally, the syntax is fine. A blank page or “There has been a critical error on this website” means a typo, so upload your backup copy and add the lines again.

Method 3: Set PHP Values in .htaccess (LiteSpeed)

Hostinger runs LiteSpeed Web Server on its shared and cloud plans. LiteSpeed reads Apache-style directives in your .htaccess file, so you can set PHP values there with php_value lines. Hostinger documents this method for settings that are missing from hPanel.

Open public_html/.htaccess in File Manager and paste this at the very top:

# Increase PHP limits (LiteSpeed, or Apache with mod_php)
php_value memory_limit 512M
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300

Save and reload the site. If it loads, the lines were accepted. Values above your plan’s maximum are not applied.

On other hosts that run Apache with PHP-FPM or CGI instead of LiteSpeed, php_value lines trigger a 500 Internal Server Error. If that happens, delete them and use Method 4 instead.

Method 4: Create or Edit .user.ini in public_html

A .user.ini file is PHP’s own per-folder configuration file for CGI and FastCGI setups. On LiteSpeed it only works if the host has enabled it. Hostinger’s documentation only covers hPanel and .htaccess, so treat this as a fallback and check the result afterwards.

In your public_html folder, check whether a .user.ini file already exists. If not, create a new file with that exact name (note the leading dot).

Add these lines:

memory_limit = 512M
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
max_input_time = 300

PHP rereads .user.ini files every 300 seconds by default, so a change can take up to five minutes to show. See the official PHP memory_limit documentation for how the setting works.

Check That the New Limit Is Active

Don’t assume a setting took effect just because you saved a file. Check what PHP and WordPress actually see.

From the dashboard (no SSH needed):

  1. Log in to your WordPress admin.
  2. Go to Tools > Site Health.
  3. Click the Info tab and expand the Server section.
  4. Check the PHP memory limit row. It should show the value you set, for example 512M.
  5. Expand the WordPress Constants section to confirm WP_MEMORY_LIMIT matches what you put in wp-config.php.

The WordPress Site Health Screen guide explains the other rows on that screen.

Over SSH: connect to your Hostinger account, cd into your site’s public_html folder (WP-CLI must run inside the WordPress folder), and run:

# Check PHP CLI active memory limit
php -r 'echo ini_get("memory_limit") . PHP_EOL;'
# Check what WordPress sees via WP-CLI
wp eval 'echo "WP Frontend: " . WP_MEMORY_LIMIT . " | System PHP: " . ini_get("memory_limit") . PHP_EOL;'

The first command prints a single value. The second prints the WordPress value and the PHP value on one line. Both report the command-line PHP configuration, which can differ from what your website gets, so trust Site Health for the web value.

If the Memory Error Still Appears

These are the usual reasons an increase doesn’t work:

  • The error already shows your plan’s maximum. If the byte figure in the error equals your plan’s cap (1073741824 bytes is 1024MB), you can’t raise it further in a config file. A plugin or import is using far more memory than normal. Deactivate plugins one at a time to find it, or split a large import into smaller files.
  • Site Health still shows 128M. The server-level value didn’t change. Re-open PHP Options in hPanel and confirm it saved. Also remove any older, lower memory_limit line in .htaccess or .user.ini so only one setting is in play.
  • The wp-config.php lines have no effect. If they sit below require_once ABSPATH . 'wp-settings.php';, WordPress has already loaded before it reads them. Move them anywhere above the “That’s all, stop editing!” comment.
  • 500 error right after editing .htaccess. The server doesn’t accept php_value lines. Remove them and use hPanel instead.
  • The staging site still crashes. Hostinger’s staging tool gives the staging copy its own wp-config.php and .htaccess, so repeat file edits there. See how to set up and manage a WordPress staging site in hPanel.

Frequently Asked Questions

What does “Allowed memory size of 134217728 bytes exhausted” mean?

It means a single PHP request tried to use more than 128MB, the limit PHP was allowed. PHP stops the request at that point, which leaves a white screen or a “critical error” message. Raising memory_limit in hPanel above 128MB fixes it unless a plugin is using memory without limit.

What PHP memory limit does WooCommerce need on Hostinger?

WooCommerce’s server recommendations call for a WordPress memory limit of 256MB or more. For large catalogs or stores running many extensions, 512MB gives you more headroom. Set the PHP value in hPanel first, then match it with WP_MEMORY_LIMIT in wp-config.php.

Why does Site Health still show 128MB after editing wp-config.php?

Because the server-level PHP limit is still 128MB, and WordPress cannot go above what PHP allows. WP_MEMORY_LIMIT only asks for more memory; it can’t override the host. Raise the value under Advanced > PHP Configuration > PHP Options in hPanel first, then check Site Health again.

Does a higher PHP memory limit slow down my website?

No. Raising the limit doesn’t make PHP use more memory on every request. It only raises the ceiling, so memory-hungry tasks like imports and image processing are not stopped halfway. Normal page loads use the same amount of memory as before.

Does changing the PHP version in hPanel reset the memory limit?

It can, so check after every switch. After you change PHP versions in hPanel (for example from PHP 8.1 to 8.3), re-open the PHP Options tab and confirm your values are still there. Then check Tools > Site Health to make sure WordPress sees the same limit.

Next Steps

Re-run the task that crashed, whether that was an image regeneration, an XML or CSV import, or an Elementor page update. If it was a theme demo import that failed, follow the guide to fix an Envato demo import that fails or gets stuck. If the Elementor editor still spins after the increase, see how to fix Elementor stuck on the loading screen.

all_in_one_marketing_tool