问题
So Google wouldn't crawl anywhere on my live site other than some simple first pages - instead just giving me 500 errors. Fetching as Google in the Webmaster tools showed that it would return the full html output with the header "HTTP/1.0 500 Internal Server Error". I work locally in xampp with display_errors turned on but couldn't see any problems there so I checked the error_log on the live server - nothing there either. Eventually I decided to switch on display_errors on the server - I don't have php.ini access so I just added "php_flag display_errors on" to the htaccess file. When I did this Google no longer returned a 500 internet server error and will now index the page! The weirdest thing is no new PHP errors are being displayed! I just don't get it.
So basically: PHP output causes 500 error for Googlebot until I put "php_flag display_errors on" in .htaccess even though no errors are displayed.
Any help? I obviously would rather have display_errors turned off in the long run but I need to get rid of these 500 errors. I just don't know how to find out what is causing them.
回答1:
Your eval'd code (which is being silenced by a @ sign), has a parse error in it. Because of a bug with PHP (bug #45592), this will result in a PHP 500. Either fix the parse error or get rid of the Eval's somehow (you should rarely need an eval).
来源:https://stackoverflow.com/questions/10521244/googlebot-crawl-error-500-and-php-error-reporting-with-a-strange-solution