I am facing a pretty award drush problem. In order to run drush I need to use this command on my hosting:

/opt/php/bin/php -c /home/pisar/etc/php.ini 
                 -d memory_limit=128M /home/pisar/opt/drush.php

When I run

/opt/php/bin/php -c /home/pisar/etc/php.ini 
                 -d memory_limit=128M /home/pisar/opt/drush.php status

it works correctly. But when I try to do the update command:

/opt/php/bin/php -c /home/pisar/etc/php.ini 
                 -d memory_limit=128M /home/pisar/opt/drush.php upc drupal

and it fails with the message:

pm-updatestatus failed

I found out that upc runs drush in subshell with incorrect php. So I added path to php:

/opt/php/bin/php -c /home/pisar/etc/php.ini 
                 -d memory_limit=128M /home/pisar/opt/drush.php 
                 --php=/opt/php/bin/php --debug upc drupal

But it also fails without configs. When I pass configs:

/opt/php/bin/php -c /home/pisar/etc/php.ini 
                 -d memory_limit=128M /home/pisar/opt/drush.php 
                 --php=/opt/php/bin/php\ -c\ /home/pisar/etc/php.ini\ 
                 -d\ memory_limit=128M --debug upc drupal

it fails because it tries to run them using quoted php with params:

Backend invoke: '/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M' /home/pisar/opt/drush.php --php='/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M'  [command]
 --backend=2 --verbose --debug --root=/home/pisar/site.com/docs/drupal --uri=http://default  pm-updatestatus drupal 2>&1 [1.45 sec, 14.72 MB]
'/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M' /home/pisar/opt/drush.php --php='/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M'  --backend=2      [notice]
--verbose --debug --root=/home/pisar/site.com/docs/drupal --uri=http://default  pm-updatestatus drupal 2>&1 [1.45 sec, 14.73 MB]
The command could not be executed successfully (returned: /opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M: not found

I put this:

export DRUSH_PHP='/opt/php/bin/php'
export PHP_INI='/home/pisar/etc/php.ini'
export PHP_OPTIONS='-d memory_limit=128M'

into ~/.profile, ~/.bash_profile and ~/.bashrc. Then ran without --php, but nothing helped.

How to fix?


I had to use --php-options parameter. The working command looks like this:

/opt/php/bin/php -c /home/pisar/etc/php.ini -d memory_limit=128M 
                    /home/pisar/opt/drush.php --php=/opt/php/bin/php
                    --php-options="-c /home/pisar/etc/php.ini
                    -d memory_limit=128M" upc -y drupal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.