Advertisement
Skip to content

PHP memory limit increase: specific steps for WordPress, cPanel, and hosts

By Updated 8 min read

Some links on this site are affiliate links: if you buy through them we may earn a commission, at no extra cost to you. We also make Ama Affiliate Pro and Ama Affiliate Ultra and say so wherever we mention them. We recommend a tool only where it fits the job.

On this page (8 sections)
  1. The short version
  2. What PHP memory limit means and how to check it
  3. How to increase PHP memory limit in WordPress
  4. How to increase PHP memory limit in cPanel
  5. How to increase PHP memory limit on Namecheap and GoDaddy
  6. How to adjust PHP memory limit for Nextcloud
  7. Common mistakes when increasing PHP memory limit
  8. Questions people still ask

In short: Increase PHP memory limit by editing the php.ini file or adding directives in wp-config.php or .htaccess, depending on your platform. Limits usually rise from 128MB to 256MB or more for heavy sites.

Part of our guide on web page slowdown on shared hosting

Clear, platform-specific steps to increase PHP memory limit in WordPress, cPanel, Namecheap, GoDaddy, and Nextcloud for smoother site performance.

At a glance
Default PHP memory limit128MB
Common increased limit256MB to 512MB
WordPress constantWP_MEMORY_LIMIT
Config filephp.ini or wp-config.php
Hosts requiring supportNamecheap, GoDaddy
Nextcloud memory need512MB+

The short version

  • Check current PHP memory limit to avoid guesswork.
  • Edit php.ini or wp-config.php depending on your setup.
  • Hosts like Namecheap and GoDaddy may require cPanel or support requests.
  • Nextcloud needs PHP config adjusted for its memory-heavy tasks.
  • Avoid changes that exceed host-imposed maximum limits.

What PHP memory limit means and how to check it

PHP memory limit is the maximum amount of RAM PHP scripts can consume during execution. It is set per server or hosting environment and affects performance and error prevention.

Low memory limits cause errors like 'Allowed memory size exhausted,' especially on resource-heavy sites using plugins or automation tools.

Check your current PHP memory limit by creating a phpinfo.php file with 'phpinfo();' inside and accessing it via browser, or use WordPress plugins that display server info.

The PHP memory limit can vary widely depending on the server configuration, usually ranging from 64MB to 512MB or more. Shared hosting plans often default to 128MB, which may be insufficient for complex sites. If that sounds like your situation, read up on blog memory limit with ai writing next.

You can also check the memory limit through WordPress by installing plugins like 'Health Check' or 'Query Monitor,' which display server environment details directly in the dashboard.

If you see inconsistent memory limits reported, the server might be using different configurations for CLI and web server PHP, so test with phpinfo in both contexts if possible.

How to increase PHP memory limit in WordPress

phpinfo page displayed on monitor
phpinfo page displayed on monitor

WordPress allows increasing PHP memory limit by defining the WP_MEMORY_LIMIT constant in the wp-config.php file. This is the safest and most common method. It helps to understand wordpress 2mb upload limit fix before going further.

Add the line define('WP_MEMORY_LIMIT', '256M'); near the top of wp-config.php before 'That's all, stop editing'. This raises the limit to 256MB.

If this does not work, edit the server’s php.ini file to set 'memory_limit = 256M' or use .htaccess directives if your host allows.

Some shared hosts restrict memory limit increases beyond their maximum allowed value, so check with your provider if changes fail. We cover php fpm checks for ttfb delays in its own article.

If your WordPress theme or plugins demand more memory, you might need to set WP_MEMORY_LIMIT to 512M or higher, but only if your host supports it.

Some managed WordPress hosts disable changes via wp-config.php, so check your host's documentation or support channels to confirm if this method applies.

After increasing memory, clear any caches (browser, WordPress, server) to ensure the new limit is active and test your site for stability and performance. We go through adding subtitles to youtube videos step by step elsewhere on the site.

  1. Access your WordPress site's root directory via FTP or file manager.
  2. Open wp-config.php for editing.
  3. Add define('WP_MEMORY_LIMIT', '256M'); above the 'stop editing' line.
  4. Save and upload the file back if editing locally.
  5. Check site functionality and error logs for improvements.

How to increase PHP memory limit in cPanel

Most shared hosting providers use cPanel, which offers a straightforward way to change PHP memory limit if allowed by the host.

Login to cPanel, locate the 'Select PHP Version' or 'MultiPHP INI Editor' section depending on your version.

In the PHP options, adjust the 'memory_limit' value to 256M or higher if your host allows. Before you commit to anything, it is worth looking at how to structure activity books quickly.

Save changes and verify by reloading your phpinfo page or checking your website for memory errors.

In some cPanel versions, the MultiPHP INI Editor applies changes only after you select the correct PHP version for your domain.

If memory_limit changes do not take effect, check for user.ini or .user.ini files in your web root that might override settings.

Testing by uploading a phpinfo.php file after changes helps confirm if the new memory limit is active. Look for the 'memory_limit' line under 'Core' in the output.

  1. Login to cPanel dashboard.
  2. Navigate to 'MultiPHP INI Editor' or 'Select PHP Version'.
  3. Choose the domain or directory you want to configure.
  4. Find 'memory_limit' and increase it to 256M or as needed.
  5. Click save and test your site performance.

How to increase PHP memory limit on Namecheap and GoDaddy

wp-config.php file open in text editor
wp-config.php file open in text editor

Namecheap and GoDaddy mostly use cPanel hosting, but limits can vary by plan and server type.

For cPanel users, follow the cPanel method in the previous section. For managed WordPress hosting, these providers often restrict direct php.ini edits.

In such cases, contact support to request a PHP memory increase or use their dashboard’s PHP settings panel if available.

Adding memory limit commands in .htaccess or wp-config.php can work but only if the host permits overriding defaults.

Namecheap's shared hosting plans usually allow increases up to 256MB via cPanel, while higher limits require VPS or dedicated hosting.

GoDaddy's managed WordPress plans often restrict memory increases, so adding directives in .htaccess may be ignored.

If your changes are not applied, verify by creating a phpinfo file and checking the reported memory_limit value to confirm what your server uses.

  1. Check your hosting dashboard for PHP or server settings.
  2. Try adding php_value memory_limit 256M in .htaccess if allowed.
  3. Edit wp-config.php to define WP_MEMORY_LIMIT if on WordPress.
  4. If changes don’t apply, open support ticket requesting memory increase.
  5. Confirm change by checking with phpinfo or error logs.

How to adjust PHP memory limit for Nextcloud

Nextcloud needs higher PHP memory for file handling and app processing, typically at least 512MB.

Edit the php.ini file on your server or hosting panel to set 'memory_limit = 512M' or more.

On shared hosts, increase the limit via cPanel or request support if your plan restricts changes.

Restart your web server or PHP process after changes to apply settings for Nextcloud.

Nextcloud’s heavy file operations and syncing tasks can exhaust memory quickly; setting memory_limit to 512MB or 768MB often prevents errors.

Some Nextcloud users report needing to increase memory_limit even further, up to 1GB, especially with many installed apps or large file transfers.

If you run Nextcloud on a VPS or dedicated server, increasing PHP memory limit is straightforward, but on shared hosting you might need to upgrade your plan or contact support.

  1. Locate your active php.ini file by running 'php –ini' or checking phpinfo.
  2. Open php.ini and find or add the line: memory_limit = 512M.
  3. Save changes and restart PHP or your web server service.
  4. Confirm new memory limit with phpinfo or Nextcloud's admin settings.

Common mistakes when increasing PHP memory limit

cPanel dashboard showing PHP settings
cPanel dashboard showing PHP settings

Not restarting your web server or PHP-FPM service after editing php.ini or .htaccess is a common error; changes won’t take effect until restart.

Conflicts arise if you set memory limits differently in multiple places, like wp-config.php and php.ini; only one should control it to avoid confusion.

Setting memory limits too high without adequate server RAM can cause server instability or crashes, so balance settings with available system resources.

  • Editing wrong file– verify which php.ini is active before changing.
  • Setting limits above host maximum– changes won’t apply without host support.
  • Forgetting to restart PHP or server after edits– new settings stay inactive.
  • Using too low memory for heavy plugins or apps – 128MB often insufficient.
  • Adding directives in both .htaccess and php.ini causing conflicts – use one method per site.
The verdict

Editing wp-config.php offers the easiest memory increase for WordPress; cPanel tools simplify it for many hosts. Support requests are sometimes unavoidable.

Questions people still ask

How do I know if my PHP memory limit is too low?

If your website shows errors like 'Allowed memory size exhausted' or crashes when running heavy plugins, your memory limit is likely too low.

Can I increase PHP memory limit without hosting support?

You can try editing wp-config.php or .htaccess, but many hosts impose hard caps requiring their intervention.

What is the safest way to increase memory in WordPress?

Use the WP_MEMORY_LIMIT constant in wp-config.php first; it’s the simplest and least intrusive method.

Will increasing PHP memory limit speed up my site?

Not directly. It prevents crashes on heavy processes but doesn’t improve loading speeds on its own.

Is 512MB PHP memory limit necessary for all sites?

No. Simple blogs run fine with 128-256MB. Larger or plugin-heavy sites benefit from 512MB or more.

Ready to try it? Hostinger provides affordable hosting solutions that can help ensure your WordPress site runs smoothly with the necessary PHP memory limit adjustments.

Explore hosting options
Sophie Adams Editor

Sophie edits My Digital Buy. Guides are written from each product's own sales page, pricing page and documentation, and say what each tool is good for and what it is not. We make Ama Affiliate Pro and Ultra ourselves and say so wherever we mention them.

More in WordPress Speed & Fixes