mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 4 years 46 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Drush, Drupal 8, MAMP, and the magic_quotes_gpc problems

The latest version of Drush gives me this error, but only with Drupal 8 sites:

PHP's 'magic_quotes_gpc' and 'magic_quotes_runtime' settings are not supported and must be disabled.Drush command terminated abnormally due to an unrecoverable error.         

I'm using MAMP, so I turned all magic quote related stuff off in /Applications/MAMP/bin/php/php5.3.6/conf/php.ini, and restarted the servers. When loading a phpinfo() file in the browser, all magic-quote-related directives are off. However, when running
echo "<?php phpinfo();" | php | grep magic_quotes_gpc

on the command line, it tells the they are still on.
Upon further investigation, I noticed that from the command line, php was looking for its php.ini file in /etc/, so I needed to link the two:
mv /etc/php.ini /etc/php.ini.backup
ln -s /Applications/MAMP/bin/php/php5.3.6/conf/php.ini /etc/php.ini

Now, after restaring the servers, drush works fine.

This helped. Thanks.

This helped. Thanks.

Specifically I added lines to my MAMP php.ini file to turn off runtime and gpc:

; Magic quotes
;

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
magic_quotes_runtime = Off
magic_quotes_gpc = Off

Hey, thank you for this post.

Hey, thank you for this post. I am at DrupalConMunich right now and your post was really helpful. Drush is working now for me.
Thanks!

Boris (@borisbaldinger)

I tried this, and it didn't

I tried this, and it didn't help. It turns out that PHP 5.3.x has magic_quotes_gpc on by default, and doesn't turn them off unless you specifically define them as disabled.

So add

magic_quotes_gpc = Off

to your MAMP php.ini as Anonymous up there says and you should be fine.

Further reading: http://drupal.org/node/1569456

cam8001

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.