Drush out of memory when php memory limit is 1024M on my dedicate server. (CentOS) This happened when I restarted Apache because my site was down. Normally restarting Apache or other service doesn't break Drush, but today it happened.

I'm sure on my server my php.ini has memory limit set to 1024M, this is my own dedicate server, and the Drupal installation runs well, I check the status report on Drupal (admin/reports/status), the PHP memory limit is set to 1024M.

This happened on my Drupal sites on my server.

When I...

[root: sites]# drush st


I got

Drush command terminated abnormally due to an unrecoverable error.       [error]
Error: Out of memory (allocated 10485760) (tried to allocate 122880
bytes) in /home/mywebsite/public_html/modules/system/system.module, line 1336


I also tried...

[root: sites]#  php -i | grep memory_limit


And I got

memory_limit 1024M


Is there anyone has some ideas?

My Server:


CENTOS 5.9 x86_64
WHM 11.36.0 (build 14) 
PHP 5.2.17
Drush 5.8


I've tried drush status --debug and it gave me :


  Bootstrap to phase 0. [0 sec, 3.02 MB]
  [bootstrap] Drush bootstrap phase : _drush_bootstrap_drush() [0.01
  sec, 3.23 MB] [bootstrap] Cache HIT cid:
  5.8-commandfiles-0-15880291c3f5c759ee66bf106fd77cbd [0.01 sec, 3.24 MB]        [debug] Bootstrap to phase 0. [0.04 sec, 7.43 MB]
  [bootstrap] Drush bootstrap phase : _drush_bootstrap_drupal_root()
  [0.05 sec, 7.49 MB]                [bootstrap] Drush command
  terminated abnormally due to an unrecoverable error.
  [error] Error: Out of memory (allocated 10485760) (tried to allocate
  122880 bytes) in
  /home/mywebsite/public_html/modules/system/system.module, line 1336 [0.06
  sec, 9.28 MB]
Your particular setup might be one that (deliberately) has 2 php.ini files:


for Apache, e.g. on your server at: /etc/php5/apache2/php.ini (or similar path depending on your distro)
for command line (i.e. for drush) e.g. on your server at: /etc/php5/cli/php.ini (or similar path depending on your distro)


(I believe that this is perfectly normal kind of setup to have 2 files, I have this myself.)

You need to ensure that memory_limit is 1024M is set for /etc/php5/cli/php.ini(or similar path depending on your distro) php executed in the command line/terminal/console i.e. drush. You could also try memory_limit is -1 which allows the server to allocate as much memory as is available.