A secure home for your next big idea. Explore hosting →

Knowledgebase / cPanel and Backups

How to Increase PHP Memory Limit Safely

Confirm a real PHP memory-exhaustion error, adjust the supported limit within your account allowance and verify the affected workload.

Prerequisites and diagnosis

Have access to the application’s private error log and the hosting PHP settings. Record the current effective memory limit, web PHP version and exact action that fails. A generic 500 error is not enough evidence to justify changing memory settings.

Look for a memory-exhaustion message at the matching timestamp. Preserve the relevant redacted log line. A large import, image-processing task or defective plugin can consume memory for different reasons, and a larger allowance may only postpone a recurring failure.

Understand the limit

PHP memory_limit controls how much memory a PHP script may allocate under that runtime’s rules. It is not the same as total server RAM, account resource allowance, upload size or the number of simultaneous workers. Increasing per-request capacity can increase overall pressure when many requests run together.

Check the application’s requirements and the provider’s permitted range. Choose a justified value within that range. Avoid unlimited settings and do not assume that a value shown in a tutorial is suitable for a shared hosting account.

Step 1: Change the supported configuration

  1. Back up the current configuration or record the original value.
  2. Open cPanel MultiPHP INI Editor if the provider enables it.
  3. Select the intended domain or approved configuration scope.
  4. Set memory_limit to the reviewed value and apply the change.
  5. If that control is unavailable or overridden, ask the provider which configuration source governs the domain.

Do not add PHP directives to .htaccess unless the host confirms that its handler supports them. Unsupported directives can create a new server error. A domain may use a different configuration from the command-line PHP executable used by scheduled jobs.

Step 2: Check application-level settings

WordPress has application memory constants that can request different limits for normal and administrative operations, subject to the server’s configuration. Before editing wp-config.php, make a protected backup and check for an existing definition. Do not add repeated conflicting definitions.

For example, a reviewed WP_MEMORY_LIMIT setting must use a value approved for the workload and account. It cannot create physical memory or override every host-enforced restriction. Prefer the application’s supported configuration documentation and have support confirm the effective result.

Step 3: Verify the effective runtime

Use a private application system-information screen to check the actual web value. If a temporary diagnostic file is needed, restrict it and remove it afterward. A saved control-panel setting is not proof that the relevant process has loaded it.

Repeat the original task with controlled data. Monitor errors and resource usage. For a cron-only failure, verify the CLI runtime separately rather than changing a web setting and assuming it applies.

Troubleshooting and expected result

If the new value is not effective, investigate configuration precedence and provider limits. If memory use grows until it reaches every new limit, investigate the application, query size, image dimensions or batch size instead of continuing to raise the cap.

Success means the intended operation completes within a reviewed resource allowance and normal traffic remains healthy. Retain the old value for rollback and document the reason for the change. Escalate recurring exhaustion with the workload description and redacted error details.

Frequently asked questions

Will this increase upload size?

Not by itself. Upload and request-size settings are separate limits.

Can I set unlimited memory?

Avoid that as a generic fix. Use a justified limit within the provider allowance.

Why does cron still fail?

CLI PHP may load a different executable and configuration from web PHP.

Related guides and hosting options

Compare WordPress hosting against your application requirements. Confirm available tools and management responsibilities for your own account. For account-specific help, open a private support ticket with the domain, time and relevant redacted error.

Official references