If I run the drush command it is unable to detect that it is infact in the drupal root directory.
Specifying the root directory doesn't resolve this either.

li37-144:/home/user/public_html/drupal# dr status -v 2
Found command: status [bootstrap]
Could not find a valid Drupal installation

CommentFileSizeAuthor
#7 drush_safe_doc.patch501 bytesanarcat

Comments

owen barton’s picture

Do you have a sites/default/settings.php with a valid database in this Drupal root?

troynt’s picture

li37-144:/home/user/public_html/drupal# find -name 'settings.php'
./sites/default/settings.php

Yes.

base url & database are both specified in the settings.php file.

My install is pretty vanilla, this is a fresh install no modules added.

I've ran into issues with this newer version on every site I've attempted to use it on.
The module version works fine, however I get that ugly "revoked" error.

troynt’s picture

Add -d safe_mode=Off flag to command.
drush='php -d safe_mode=Off ~/drush/drush.php'

This should be in the readme.

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)
fenstrat’s picture

Version: 6.x-2.0-alpha2 »
Status: Postponed (maintainer needs more info) » Active

safe_mode=Off

This should be in the readme.

Agreed, php's safe mode is a game wrecker.

Need to make sure alias' are defined as:
alias drush='php -d safe_mode=Off /path/to/drush/drush.php'

It also appears that sequential commands called from drush are still running in safe mode (haven't had a chance to look deeper so this is a stab in the dark):
drush update reports code update completed [ok] yet its call to updatedb fails saying there's no valid drupal install
running them seperatly, i.e. calling drush updatecode then drush updatedb and both complete [success].

fenstrat’s picture

All the above issues I mentioned are resolved if safe_mode is turned off globally (i.e. in php.ini)

If altering drush to work within safe_mode restrictions isn't an option (and I'm guessing it's not), then at least the readme needs to make prominent mention of the fact that drush doesn't work with php's safe_mode on.

anarcat’s picture

Component: Code » Documentation
Status: Active » Needs review
StatusFileSize
new501 bytes

This seems pretty minor then, just a documentation change... What do you think of this one?

fenstrat’s picture

No good. Turning off safe_mode works for single commands, e.g. updatecode, updatedb. However the update command calls updatedb AFTER updatecode which will then revert to global php.ini settings. So no good unless safe_mode is turned off globaly in php.ini

Could each subsequent call to drush keep any inbound parameters, i.e. safe_mode=Off? Or just easier to make safe_mode=Off a requirement?

anarcat’s picture

I think having safe_mode off in php.ini could be a requirement. I fail to see what fail_safe gains anyone in commandline anyways...

moshe weitzman’s picture

Seems like we should do a very fast requirements check at beginning of script. we should check safe_mode and php version (seems like we have issues on php4 and i don't care).

moshe weitzman’s picture

FYI, I have just issued an RC1 release.

owen barton’s picture

I have a patch for checking php5 and safe_mode in my sandbox - I'll try and polish it up.

owen barton’s picture

Status: Needs review » Patch (to be ported)

Committed checks for php5 and safe_mode in _drush_bootstrap_drush_validate()

owen barton’s picture

Status: Patch (to be ported) » Fixed
owen barton’s picture

Status: Fixed » Needs work

Hmm, this doesn't really help - the try/catch for PDO at the bottom of environment.inc still causes "Parse error: syntax error, unexpected '{' in .../drush-head/includes/environment.inc on line 777" in php4, which is totally unhelpful and unfriendly.

I guess we have have several options:
* Move the PDO validation to a separate inc, and conditionally include it when needed (which would be after the php version validation, so we wouldn't need a specific check)
* Figure out another way of doing it, other than try/catch
* Exec it as a string
* Move the PHP version detection and message out of the "official" validation function, and to the very top of drush.php (so we can die() before hitting the includes.

Any preferences?

adrian’s picture

how about adding a commands/core/php engine

and making a bootstrap.inc with only that bit

owen barton’s picture

Title: Drush Unable to Detect that it is in the Drupal Root Directory » PHP5 validation
owen barton’s picture

Status: Needs work » Fixed

Moved PHP version check to drush.php, since environment.inc try/catch doesn't parse in php4. At some point we could move this to an engine, if we find enough cases to make it worthwhile.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Detroit Dan’s picture

The only way I can get drush to work on my web.com Linux system is to bypass php.ini (-n option). So I changed the drush bash shell to invoke drush.php as follows: /usr/bin/env php -nd safe_mode=Off $SCRIPT_PATH "$@"

I'm using PHP 5.2.10 (cgi) (built: Aug 20 2009 07:17:05)
Zend Engine v2.2.0