Community Documentation

Modifying the PHP or PHP configuration that drush runs under

Last updated March 12, 2013. Created by gpk on October 7, 2011.
Edited by manish_mics, greg.1.anderson, moshe weitzman. Log in to edit this page.

How to modify which PHP drush uses

You can set the the environment DRUSH_PHP in your shell. Its value should be the /path/to/php. You can set it in your .profile or similar file to have it always available. Or you can alias drush = DRUSH_PHP=/usr/bin/php5 drush

How to modify PHP settings if you do not have access to the system-wide php.ini?

Easy: look in the examples folder for example.drush.ini and follow the instructions there. This is useful if you need to change PHP memory_limit, max script execution time, disable_functions etc.

This is also useful if you want drush to use different PHP settings from the website itself. Note that since drush uses PHP-CLI, it is unaffected by PHP directives in httpd.conf, .htaccess, or a php.ini file in the Drupal root.

Alternately, you may also create your own php.ini file, and point the PHP_INI environment variable to it.

Using an alias to run drush.php directly from php

In the past, the Drush README.txt recommended creating an alias to drush.php, and run it directly with php. This technique is no longer recommended; always use the provided drush script and the DRUSH_PHP and PHP_INI environment variables to set the Drush environment to use.

If for some reason this proves to be impossible, and you must run drush.php directly, be sure to read the drush script and insure that your alias passes the --php and --php-options options, in the same way that the script does.

nobody click here