Magic Quotes Error With Drupal 8 Installation
We’ve had a few members start to test Drupal 8 and several ran into a problem during the installation.
Basically their hosting service is out-of-date or incorrectly set up. During the installation they get an error message saying that something called “Magic Quotes” isn’t supported.
Here’s an explanation of that problem and how you can fix it.
Some Background on this Problem
As Drupal advances, it requires more updated versions of the underlying software.
For example, Drupal 8 requires PHP 5.3.5. This is a good thing, because PHP 5.2 is dead software. Support for PHP 5.2 ended in September 2011.
So, PHP 5.3 is a good version to use for your site. However, it does start the removal of some features, including one called Magic Quotes. Drupal 8 asks that Magic Quotes feature be disabled.
However, many hosting companies still haven’t updated to PHP 5.3.5 or later, either out of laziness or perhaps a fear of breaking their customers websites.
If you have a hosting company that hasn’t updated or hasn’t turned off Magic Quotes, here’s what to do in order to use Drupal 8.
Step 1: Upload your Drupal 8 Files
- Upload the Drupal 8 files to your server as with a normal installation.
- If you have the Magic Quotes problem, when you try to access the installation screen you’ll get an error like this:
Step 2: Create a PHP.ini File
- Using an FTP manager or your hosting control panel, access your site’s files. They will look like the image below:
- Create a file called php.ini.
- Add the code below:
magic_quotes_gpc = Off extension=pdo.so extension=pdo_mysql.so
Note: If you are using a hosting company, it is possible that they want you to modify your php.ini file in a different way. Consider raising a support ticket with them to check.
Step 3: Add to your .htaccess File
- Find your .htaccess file.
- Open the file and add this code.
- Change “myusername” and “yourD8folder” to match the folder names that you are using.
<IfModule mod_suphp.c> suPHP_ConfigPath /home/myusername/public_html/yourD8folder <Files php.ini> order allow,deny deny from all </Files> </IfModule>
Step 4: Recheck your Installation
- Revisit your Drupal installation screen and you should be able to complete the installation.
- If you are still having problems, check with your hosting company on how you turn Magic Quotes off.
This also applies to Joomla 3.0 where Magic Quotes GPC must be off before the installation can proceed.
On some hosts, the php.ini file must be placed in drupalroot/core/ in order to be read; i.e., it must be in the same location as the install.php script.