Skip to main content
Maher Sakka's Blog
Main navigation
  • Home
  • Contact me
Language switcher
Breadcrumb
  1. Home
  2. Blog
  3. How To Bypass The "PHP Fatal Error: Allowed Memory Size of X Bytes Exhausted" Error In Drush

How to bypass the "PHP Fatal error: Allowed memory size of X bytes exhausted" error in Drush

Image
How to bypass the "PHP Fatal error: Allowed memory size of X bytes exhausted" error in Drush

The "PHP Fatal error: Allowed memory size of X bytes exhausted" error in Drush indicates that a PHP process initiated by Drush has exceeded the allocated memory limit.

This can occur during various operations, such as clearing caches, running updates, or importing content, especially on sites with numerous modules, complex data, or demanding administrative tasks.

There's two solutions to bypass this issue; increase the php memory limit in the php configuration file or set the memory limit as parameter when executing the php drush command.

Increase PHP Memory Limit via the php configuration file.

First you have to locate the php.ini file loaded in the console. You use the article to locate the php configuration file: How to know which ini configuration files are loaded with PHP.

Then find the directive memory_limit  and increase its value (e.g., memory_limit = 256M or 512M).

Set the memory limit as parameter when executing Drush

For a single Drush command, you can prefix it with 

php -d memory_limit=256M vendor/bin/drush.php 

In this cas you should the drush.php and not the binary drush.

.

Tags
  • Drupal
Related posts
  • How to clear Drupal cache via database
Tags
  • Laravel
  • Linux
  • Drupal
  • Database
  • Tips & Tricks
  • Mobile
  • Servers
  • SEO
Recent posts
  • How to bypass the "PHP Fatal error: Allowed memory size of X bytes exhausted" error in Drush
  • How to detect tables wihtout primary key in a database
  • How to know which ini configuration files are loaded with PHP
Monthly archive
  • May 2017 (2)
  • August 2018 (1)
  • October 2020 (1)
  • August 2023 (1)
  • July 2024 (2)
  • November 2024 (1)
  • July 2025 (10)
  • October 2025 (6)
  • December 2025 (1)
Projects
  • elmanager.tn
  • 365mathex.com
  • vpop.tn
  • toufoula.tn
  • writethemoney.com
  • dinartunisien.com
RSS feed

mahersakka.com © 2024 
Build Your IT Skills, Grow Your Wealth with Maher Sakka