Hi all,

Just installed drush on my Mediatemple (dv), trying to run drush i get the safe_mode = off issue. Some mentioned that there was a seperate php.ini for CLI, but i was unable to locate it on my system. And not willing to do a global safe_mode=on in my php.ini, i scorged the interwebz for some help.. NONE available!

So while looking into the docs of the php CLI (http://php.net/manual/en/features.commandline.php) i found the -d command line option.

"This option allows you to set a custom value for any of the configuration directives allowed in php.ini."

So changed the ./drush file, one of the last lines

From:
/usr/bin/env php $SCRIPT_PATH "$@"

To:
/usr/bin/env php -d safe_mode=Off $SCRIPT_PATH "$@"

SALUTÉ

Worked!

If running low on mem you could also change it to this.

/usr/bin/env php -d memory_limit=512M -d safe_mode=Off $SCRIPT_PATH "$@"

This could also be done alot nicer by putting it into ie. a PHP_OPTIONS variable.

/usr/bin/env php $PHP_OPTIONS $SCRIPT_PATH "$@"

/Philip

CommentFileSizeAuthor
#1 safe-mode.patch791 bytesgreg.1.anderson

Comments

greg.1.anderson’s picture

Title: How i fixed the safe_mode problem » Force safe-mode=off [How i fixed the safe_mode problem]
Version: All-Versions-2.1 »
Priority: Normal » Minor
Status: Active » Needs review
StatusFileSize
new791 bytes

Safe mode is deprecated in php 5 and will be removed in php 6; that said, though, it would be innocuous to force it off for drush as suggested above, and might save a person or two some trouble.

The enclosed patch forces safe mode off as described above. The php-cli branch is not touched, under the assumption that if folks are running on a site with a separate php-cli, then they can just turn off safe mode in the cli php.ini file.

Worth doing? There is some risk that this might cause drush to stop working when php 6 comes out, but I don't think there's a good way of investigating that in advance.

moshe weitzman’s picture

Status: Needs review » Closed (won't fix)

this is too much for drush imo.