Skip to content

Instantly share code, notes, and snippets.

@ccamara
Last active December 20, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccamara/6138403 to your computer and use it in GitHub Desktop.
Save ccamara/6138403 to your computer and use it in GitHub Desktop.
Increase #drush memory limit. #drupal
<?php
/**
* Examples of valid statements for a Drush runtime config (drushrc) file.
* Use this file to cut down on typing out lengthy and repetitive command line
* options in the Drush commands you use and to avoid mistakes.
*
* Rename this file to drushrc.php and optionally copy it to one of the places
* listed below in order of precedence:
*
* 1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
* 2. Drupal sites/all/drush folder.
* 3. In any location, as specified by the --config (-c) option.
* 4. User's .drush folder (i.e. ~/.drush/drushrc.php).
* 5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
* 6. Drush installation folder.
*
* If a configuration file is found in any of the above locations, it will be
* loaded and merged with other configuration files in the search list.
*
* If you have some configuration options that are specific to a particular
* version of Drush, then you may place them in a file called drush5rc.php.
* The version-specific file is loaded in addition to, and after, the general-
* purpose drushrc file. Version-specific configuration files can be placed
* in any of the locations specified above.
*
* IMPORTANT NOTE regarding configuration file on Windows:
*
* For Windows 7, Windows Vista, Windows Server 2008 and later versions is the
* system window configuration folder C:\ProgramData\Drush. For previous
* versions of Windows is the folder C:\Documents and Settings\All Users\Drush.
*
* IMPORTANT NOTE on configuration file loading:
*
* At its core, Drush works by "bootstrapping" the Drupal environment in very
* much the same way that is done during a normal page request from the web
* server, so most Drush commands run in the context of a fully-initialized
* website.
*
* Configuration files are loaded in the reverse order they are shown above. All
* configuration files are loaded in the first bootstrapping phase, but
* a configuration file in a specific Drupal site folder other than the default
* (eg, sites/example.com/drushrc.php) will not be loaded unless a specific
* Drupal site is selected. However, it _will_ be loaded if a site is selected
* (either via the current working directory or by use of the --uri option),
* even if the Drush command being run does not bootstrap to the Drupal Site
* phase.
*
*/
// Increases memory limit.
ini_set('memory_limit', '128M');
@ccamara
Copy link
Author

ccamara commented Aug 2, 2013

Instructions:

  1. copy drush/examples/example.drushrc.php to .drush folder in your server (other locations can be found here:
    1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
    2. Drupal sites/all/drush folder.
    3. In any location, as specified by the --config (-c) option.
    4. User's .drush folder (i.e. ~/.drush/drushrc.php).
    5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
    6. Drush installation folder.
  2. add this snippet to it
  3. rename the file into drushrc.php

In order to know whether it worked or not you can ssh into it and type this command

drush php-eval 'print ini_get("memory_limit")'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment