My production live site is on godaddy ultimate shared hosting on linux. I have the same code base on both these places. But the production site is throwing internal server error 500 from the past 3 days. I have the login destination and front page modules installed and this 500 error happens only when users login and being redirected to a different landing page.
I set up such that anonymous users go to http://www.mydomain.com/publics and when logged in on this page, they get redirected to http://www.mydomain.com/landing.

This setup works perfectly fine on the dev site, but in production, I am getting the 500 error when the redirect to landing happens. Once this error is thrown, if I just type any other url of the site, I am getting to those pages fine.

The only difference between the dev and production site is the data in the DB. Both the sites were working fine for many months now and this 500 error has been happening since last 3 days only. Obviously, the godaddy tech support is of no help. THey just said they did some apache update on all servers 3 days ago and have been adamant that it has nothing to do with my issue, but the timing of when my issue started is so close to this update.
They are suggesting I move the site to a different server to test. I am a bit nervous about this and don't want to lose any prod data.

So far I have disabled fast cgi and increased the php execution time limit to 3000. None of these seem to help.

I am getting frustrated with this. Anybody else have this issue? PLEASE HELP. This is what I see in the error log

[Fri Oct 14 02:10:01 2011] [error] [client 59.93.87.62] Premature end of script headers: index.php

Comments

JamesOakley’s picture

Sounds like an endless redirection loop.

Presumably there is another difference in the production and test sites, namely the URL you are using. Are they on a different domain name? Or sub-domain? Are both sites on the same server at GoDaddy?

Have you made any changes to the default Drupal .htaccess file? If so, try reverting that to the default one and see if that helps.


This signature is currently blank
vgulla’s picture

.htaccess - no changes and the files on both servers are same.

Both the sites are on different servers (different IPs).
Production one is http://www.mydomain.com and
copied one is http://dev.mydomain.com

I have the drupal install in a subdirectory in the html directory. I didn't have to uncomment the RewriteBase line in .htaccess.
Interesting thing is both the sites were working for many months now and only giving these error for the past 3 weeks.

This is the .htaccess in the html directory
-------------------------------------------

addhandler x-httpd-php-cgi .php4
addhandler x-httpd-php5-cgi .php
addhandler x-httpd-php5-cgi .php5

RewriteEngine on
RewriteRule (.*) med/$1 [L]

First 3 lines added by godaddy tech support while disabling fast cgi.

.htaccess in my drupal directory (med)
------------------------------------------------
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
#Options -Indexes

# Follow symbolic links in this directory.
#Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.

# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600


# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /med
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

JamesOakley’s picture

Sorry - I was slow to notice you had replied!

If it stopped working and you changed nothing, the onus is certainly on them to tell you what they changed. Without knowing that it's hard to know what you have to change to compensate for it.

Having said that, what are these two lines there for, and are they there on both sites?

RewriteEngine on
RewriteRule (.*) med/$1 [L]

Just to humour me, try renaming the .htaccess file of both sites to .htaccess_old, and then putting the original .htaccess file in its place. If either both sites are then broken or both sites work, we've found that .htaccess is the culprit. If one still works and one does not the problem is elsewhere.


This signature is currently blank
vgulla’s picture

thanks for the reply jamesoakley. That redirect is in the .htaccess file that is in the root directory. I have drupal installed in a subdirectory called med and so had to put that to avoid adding /med to the urls.

JamesOakley’s picture

Have you tried installing drupal in the main directory. If you don't want /med in the URLs, the general rule would be don't put drupal in a directory called /med.

I would try putting drupal in the main directory, rather than in a subdirectory, and see if that helps. I'm not familiar with GoDaddy's control panel file manager, as it is proprietary, but I'd like to think you could just drag all the contents of /med into the html root.

*Obviously, take a backup before messing about with anything this big ;)


This signature is currently blank
facal’s picture

In the last few days I am experiencing the same problem on a site hosted on Godaddy 4GH. Moreover, some strange redir issues started to show up until the site was completely unavailable. I opened a ticket and they put back the site online but the HTTP 500 errors are still going on. Good to know that they did some apache update a few days ago, that explain it all. Luckily I am just using Godaddy for a dev project but this issue convinced me that I cannot stay with this hosting plan once I go to production status.

JamesOakley’s picture

It may not be their fault.

Equally, it may be something they've done. Better to discover these things before you go live. ;)


This signature is currently blank
vgulla’s picture

No change with mine on both sites. Yet the error now occurs on both sites. The second mirror I created also is giving the same error now without any changes I made. This is why I am suspecting it must be some php or apache update they have done that is causing this error. I am asking godaddy about it without any reply from them. How do I go about chasing this down to find out the root cause? Please help

JamesOakley’s picture

For 500 errors, they would need to look in their apache error logs, which are not domain specific so you would not have access to it. In that log, when a 500 is raised, you get a text description. It says if there is a directive in the .htaccess file that it doesn't like, if redirection has got stuck in a loop, or whatever. That would confirm the general nature of the problem. (To get even more detail they would have to restart apache in debug mode, and a shared host isn't going to do that.)


This signature is currently blank
vgulla’s picture

Here is what I found so far.

Upon enabling devel module, I found that there were way too many queries trying to retrieve the URL aliases. I have 60K nodes in my DB and on the homepage, I have a tag cloud and a quicktab block showing forms to add different content types. Each content type has a drop down or autocomplete boxes for node references. It seems the URL alias query is being fired for these dropdowns as well. When I deleted the URL aliases, the 500 error went away. When I removed the quicktab block with all the forms, the page was blazing fast.

Now, how do I go about optimizing the forms quicktab block? Secondly, is there an optimal way to use uRL aliases? I don't want to expose node/### since its not good for SEO

Thanks so much

-vasantha

JamesOakley’s picture

OK - You've tracked down the error much more precisely. Good. The 500 error could well then be because you're overloading the MySQL server. Which means the real problem is not your web host (you may have fewer problems with other hosts, but the GoDaddy server settings have led you to find a real problem that does need to be fixed).

I can see why those queries would run for each drop-down entry, from how you describe it. Not my area of expertise, I'm afraid, so I can't help. There are people who would be able to help you with this, but they won't find you in a thread called "GoDaddy 500 server errors" in the forum called "Web Hosting Support". I suggest that now you've tracked it down, you open a new thread - either in another section of the forum, or in the issue queue for whichever module you think is causing it most. That will lead others to spot what you're struggling with and pitch in if they have suggestions.


This signature is currently blank