Wordpress 2.7, 404 errors and Magic Quotes GPC
Wordpress 2.7 doesn't work well with Magic Quotes, I've learned the hard way while trying to help a fellow worker get her blog back to work this week.
The symptom was a change in the wp_options table reverting this :
a:63:{s:11:"robots.txt$";.......
to this :
a:63:{s:12:"robots.txt$";.......
Resulting in permalinks leading to 404 not found errors for all posts, pages and archives. This was only when the permalinks were the non-default type ("beautified permalinks"). The .HTACCESS file seemed in order. Then I found that this was the cause.
At the beginning I just switched it manually back, altering the table by using PHPMYADMIN, but every time she posted or saved something it would go back to the problematic code.
The problem, it seems, was caused by Magic Quotes and the only way to fix it is through changing the Magic Quotes value.
There are a number of ways you can do that. First, add this to the vhost settings :
magic_quotes_runtime = Off
magic_quotes_sybase = Off
Or you can also add this to the .htaccess :
php_flag magic_quotes_runtime Off
php_flag magic_quotes_sybase Off
Effect would be the same.
Problem was, my friend was running on a shared hosting with Anhosting so she couldn't touch the vhost and adding those flags to .htaccess resulted in 505 errors.
The way to solve this was :
I tried one more thing. It seems Anhosting allows changing some PHP variables by adding a PHP.INI file to the directory in question (http://help.midphase.com/support/questions.php?questionid=527) so I added a PHP.INI file with the following directive :
magic_quotes_gpc = Off
That seemed to do the trick. Apparently, this solves a number of other issues with Wordpress 2.7 as well. Solution was posted on the relevant Wordpress thread.





thanks for all the info, great article!!!