mediatribe.net -- Drupal et développement web

Notice: this post was last updated Il y a 5 years 6 weeks 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