Ok. So latly my site has been going error 500 crazy. I get error 500's when I try to do a lot of admin featues. Like edit somthing in views or edit my modules. WHen I go to turn a module on or off, I get an instant error 500. THen when i hit back, the module is turned on or off like I wanted. I dont get. Anyone know what to do? I cant even edit some pages now without getting the

Error 500 - Internal server error

Thanks.

From #78:

[SOLVED]
My solution has been to change a parameter for APC in php.ini:
from
apc.shm_size 64M
to
apc.shm_size 512M

Restarting apache later everything is back to normal!

There is a a good article about APC Settings / Performance for Drupal:
https://groups.drupal.org/node/127609

Comments

bdragon’s picture

Status: Active » Postponed (maintainer needs more info)

Could you get the exact error message(s) that are occurring? Check your webserver's error log (ask your provider for help if you do not know how to do this).

skallagrim’s picture

Version: 5.6 » 5.10

Mine just started that too..

Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
Premature end of script headers: index.php

If you think this is a server error, please contact the webmaster.
Error 500

alexanderpas’s picture

are you, by chance, running on a host that uses php as a cgi module?

alexanderpas’s picture

Title: Error 500 CRAZY » Error 500: Premature end of script headers
mojzis’s picture

I am having the same problem, and yes, the host has php as a cgi module :( Is there a remedy ?
Thanks

alexanderpas’s picture

check your file permissions!

this might also help: http://htmlfixit.com/cgi-tutes/tutorial_Common_Web_dev_error_messages_an...

please report back with more information

sunset_bill’s picture

I just started getting the same errors this morning--a full-page (not Drupal) 500 error on my browser and "Premature end of script headers" in my Apache error log. Uploaded a known working copy of index.php but errors didn't go away.

I'm not sure if my host (AN) is running PHP as a cgi, but that might be a clue. If they are, what is the fix?

salud,
Bill

sunset_bill’s picture

In my case, it turned out to be a corrupted php.ini file on the server. Hope this helps someone else.

ciao,
Bill

ainigma32’s picture

Assigned: ClutchPong » Unassigned
Status: Postponed (maintainer needs more info) » Fixed

Judging from the age of this post I'm going to assume that this issue was resolved.

Feel free to reopen if you think that is wrong.

- Arie

HS’s picture

I'm faced with the same problem. I'm on Drupal 6.9 Anyone facing this issue on Dreamhost? OR shared Hosting? I wonder if that has anything to do with this...

HS’s picture

Version: 5.10 » 6.9
Status: Fixed » Active
ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

@Hilalsuhaib: Have you look at the link on #6 http://drupal.org/node/213260#comment-1134332 ?
And if that didn't work, what kind of setup are you using (OS, database, PHP version etc.) ?

- Arie

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like Hilalsuhaib won't be posting any feedback so I'm setting this to fixed.

Feel free to reopen if you think that is wrong.

- Arie

HS’s picture

It is an issue with shared hosting on my end. Once the host resolved the issues with their server the problem disappeared. Sorry for not following up on this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

drupalphil’s picture

Although this is closed, I'd like to add a note for Dreamhost users in case they are struggling with "Premature end of script headers" (a server error found in user/logs/http.../error.og) and 'page not found' / internal_error.html (found in Drupal's log).

I moved a site from shared hosting to dreamhost_ps last weekend. The site worked fine for many things, but some users would get 'page not found' (internal_error.html in watchdog; 'premature end of script headers' in error.log) errors doing things on the site that I never had problems doing. For example, posting content or submitting a contact form was problematic.

I believe that it was those users with slower internet connections that were having the problem, but I couldn't prove that beyond an educated guess. I was able to eliminate these errors by doing the following:

1) created a custom php.ini following these directions
http://wiki.dreamhost.com/Custom_PHP.ini

2) edited the new php.ini to increase values for resources and change post_max_size :

max_execution_time = 1600 ; Maximum execution time of each script, in seconds
max_input_time = 1600 ; Maximum amount of time each script may spend parsing request data
memory_limit = 80M ; Maximum amount of memory a script may consume (8MB)

post_max_size = 80M

No more errors. I'm running with PHP5 as FastCGI.

Aren Cambre’s picture

#16: thanks. I also just started getting those errors on Dreamhost and am trying those settings. Will report back if they don't work.

jcamfield’s picture

I just started getting this problem on DH today also, but only on one of my sites (all using similar settings, fastcgi, etc.) This did not fix anything for me. :(

Aren Cambre’s picture

Title: Error 500: Premature end of script headers » Error 500: Premature end of script headers on Dreamhost
Version: 6.9 » 6.14
Status: Closed (fixed) » Active

It was too good to be true. The fixes in #16 don't work on Dreamhost.

This also only recently started for me, too.

jcamfield’s picture

Title: Error 500: Premature end of script headers on Dreamhost » Error 500: Premature end of script headers on Dreamhost : DISABLE ADMIN_MENU

I have 3 sites on a PS and 3 personal site on shared; 2 of the PS sites are fine, 1 of the shared is working. On the PS, the largest site (most users and content) works ok for cached/anon usage, but logged in users get 500 errors, so I can't even log in as admin to up performance. On the shared hosting sites, there is no correlation between amount of users/content and the headers.

Things I've tried with no luck:
Emptying the access_log table
running cron via /cron.php (cron failed)
running cron via drush (cron success, no improvement
Clearing a large watchdog table via drush (cleared, but no improvement)
Clearing cache (cleared, anon users could still see the site but slower)
Restoring to a recent db backup (restored successfully, no improvement)

Things that kinda worked:
Restoring a week-old backup (could occasionally access site while logged in, but while I'm operating under the assumption that this is a DH issue that we'll eventually figure out, don't want to lose a week's worth of work)

Disabling admin_menu via drush to reduce the query load for admin page rendering - got me in, slow and occasional 500s still, but hey, progress!

I suspect that there is some problem around mysql responsiveness (affected but not only caused by the DH internal network problems), php execution timeouts related to mysql, and burdensome queries caused by non-cached blocks + views + panels + logged-in-user queries

DRUSH on DreamHost notes:

edit the drush script wrapper , change the last lines to:

  # We check for a command line (cli) version of php, and if found use that.
  /usr/bin/env php-cli -v &> /dev/null
  if [ "$?" = 0 ] ; then
    /usr/local/php5/bin/php-cli $SCRIPT_PATH "$@"
  else
    # Alternatively we run with straight php, which works on most other systems.
    /usr/local/php5/bin/php $SCRIPT_PATH "$@"
  fi
fi

run drush with -u 1 (force it to use the admin account)

Aren Cambre’s picture

Title: Error 500: Premature end of script headers on Dreamhost : DISABLE ADMIN_MENU » Error 500: Premature end of script headers on Dreamhost

Reverting title. Per #20, admin_menu is not definitively the culprit.

toddgee’s picture

also having errors as described on this thread from comment #17 onward. I'm suspecting DreamHost did something to their PHP configuration. I'm on a PS as well.

Am getting 500 errors any time I try to do things like:
post admin screens (views, modules)
flush cache with admin_menu

I'm going to submit a ticket and point them here. I don't know about y'all but I've had such troubles w/ DreamHost -- our PS requires rebooting quite often. I really like their administration control panel; but sheesh....

toddgee’s picture

Dreamhost is reporting that some things are wonky right now:

http://www.dreamhoststatus.com/

Some customers are experiencing problems with their sites not loading properly. This is due to networking issues that have cropped up and our admin team is working hard to correct the problem. We’ll update this post as soon as this is resolved. We apologize for the inconvenience this has caused.

Update (2009-11-14 13:30 PST):

Our admin and dev teams are working together to resolve this and have hotfixed our move script so that we can correct the problem. We’ll update this post again when we have more information.

Update (2009-11-14 15:25 PST):

We were able to narrow down the issue (it was specific to customers with a unique IP that was not in the right part of our network to be moved to the new host machine) and have fixed it. We’re finishing up the configs that will get everything running so most of the effected customers are back up but we’ll update this again when those have all completed.

My sites are loading, just not working correctly. It's weird -- something work correctly, but some things just don't (like submitting changes to the modules screen). It's hard to see how network issues could be causing this; but ???

Aren Cambre’s picture

toddgee: my problems started a while back, I think roughly in the past 2 weeks?

dillonm’s picture

@toddgee: I'm on dreamhost and noticed some issues as well. However, I'm in the same boat as you -- some things work while some other things don't work. Right now: logging in does not work, but anonymous users are fine.

I also tried #16 and it did not work - maybe I'll do it again when dreamhost gets things back up?

Anyone else experiencing this on dreamhost?

dillonm’s picture

adding tags
dreamhost, error 500, premature end of script

ppmax’s picture

Man--im totally locked out from logging in: 500's all day. Sent a few support requests to dreamhost but no dice so far.

I have MySQL Administrator up logged in to my user account and the connection health and memory health graphs are pegged....

The only good thing that's come out of this is I reworked a few views (with templates) that were sending crazy amounts of queries (my bad on that one).

ppmax’s picture

Just wanted to add that I've had some success by going to the dreamhost panel and changing PHP Mode from PHP 5 FASTCGI to PHP 5 CGI....

dillonm’s picture

Version: 6.14 » 6.9

@ppmax I've had success switching to CGI (rather than FastCGI or mod_php). This should be a temporary fix until dreamhost can figure this one out.

dillonm’s picture

Changing to CGI is under the Dreamhost panel that's under Manage Domains / Domains / Edit (on your appropriate domain/subdomain).

ghiley’s picture

Same issues here. Occasionally pages load, sometimes 500 errors, sometimes page not found and timeout.

Dreamhost on shared hosting running Drupal with a media blog and approx 2000 posts (with photos).

SQL database queries are taking a crazy amount of time assume is part of the problem. Dreamhost has told me my scripts are being terminated due to a out of memory.

Definately know that the issues relates to pages with heavy content such as some admin pages or simply home page / main post pages. No problems loading Terms & Conditions for example.

dillonm’s picture

@ghiley Switching to PHP5 CGI seems to do the trick.

Posting discussion from dreamhoststatus.com:
http://www.dreamhoststatus.com/2009/11/14/private-server-moves-causing-d...

ghiley’s picture

Confirmed the switch to PHP5 CGI has resolved the issue (and seems to speed the site up generally). Thanks @dillonm et al. (Great weekend for go-live... sheeesh).

asodder’s picture

This is why I like Drupal - the support from all you guys... THANKS!

Before reading the PHP 5 FASTCGI to PHP 5 CGI trick I was painstakingly (and foolishly) following the advice that DH gave me in response to my ticket, which was that "the software running on it is using to much memory and our process watcher is killing your processes" and so I was trying to disable modules which obviously did not help.

Thank You

HS’s picture

"the software running on it is using to much memory and our process watcher is killing your processes"

The above is the same BS response EVERYONE gets from them. I've got it sooo many times from their agents.

dillonm’s picture

Still having FastCGI issues as of this morning ...

joanpc’s picture

I have similar problems with FastCGI and CGI :( I'm unable to load the devel module to check MYSQL delays.

dillonm’s picture

@joanpc Yep, me too, now both are completely down.

HS’s picture

My sites on Dreamhost have been slow for over 24 hours. Over 30 seconds to load a page. Dreamhost PS seems like a scam. You guys are having the same issues as shared hosting.

Aren Cambre’s picture

Version: 6.9 » 6.14

Reverting version to latest. If you're not on the latest, time to upgrade.

dillonm’s picture

I’m up and running fine now in FastCGI and CGI … anyone else?

joanpc’s picture

Works better but still slow

Aren Cambre’s picture

This morning I am getting nothing but database connectivity errors from Drupal or Premature end of script headers: index.php in my error.log.

My PHP stuff is hosted on hulk.dreamhost.com, and my MySQL is muckle.hazelnut.dreamhost.com.

ppmax’s picture

Still slow as molasses and lots of 404's and 500's. Switched to and from PHP5 FASTCGI & PHP5 CGI with no real difference. I've contacted DH support multiple times and have been told that "resource usage" is to blame. No sh*t. Most replies have advised that I consult the wiki for help finding causes of heavy usage--which I've done. This site ran fine 3 days ago. One reply was interesting:
"Also, please be aware that just because this site is the one getting killed, it isn't necessarily the problematic one."

It's got me wondering if they've combined a bunch of mysql instances...?

Aren Cambre’s picture

@ppmax: something has definitely changed in the past few weeks. I use to get pretty snappy phpMyAdmin performance, but it is dog slow lately.

I left 1and1.com because of its slowness. Was initially impressed with Dreamhost's speeds. Now it's in the tank.

Aren Cambre’s picture

Good news: Dreamhost has tacitly acknowledged major problems. Just got this update on an issue I've been messing with for a few days:

This is just a notification that your message has been moved to our severe problem queue. This queue is for major outages that cause a large amount of support to come in. Our goal is to resolve the problem based on the information you have provided. We will then send you an update once the issue is resolved. Depending on the problem it may take longer than 24 hours for a response. Please hang in there, when messages are moved here your problem is given top priority. Please note that callback support is not available for messages moved here.

Today I am getting the "Premature end of script headers" errors on many admin pages across all my Drupal sites. Strangely, my WordPress site works fine.

dillonm’s picture

I thought I was fine until just now, now I’m seeing erratic on/off 500 errors. Suggestions on other hosts? HotDrupal?

toddgee’s picture

I (author of posts 22, 23) tried switch from 'PHP 5 FastCGI' to 'PHP 5 CGI' on my DreamHost PS. I am still seeing the same 500 errors as I did (except the httpd error log says the error is with 'php5.cgi' rather than 'index.php').

Also on day 3 of being down.

Aren Cambre’s picture

Priority: Critical » Normal
Status: Active » Fixed

I'm going to mark this as fixed. Looks like Dreamhost had a problem with its core router that affected a lot of sites. Per http://www.dreamhoststatus.com/2009/11/16/downtime-across-various-homie-..., it appears to be fixed.

siharris’s picture

Status: Fixed » Active

Switching back to active. Dreamhost can say what they like, I'm still getting the same errors, worse today than yesterday.

ppmax’s picture

Is anyone running 6.13 on DH with PHP5 FASTCGI? Are you getting 500's?

This is driving me nuts. I cant figure out if this is DH or drupal causing these things. All I know is that my site ran great a few days ago then BOOM: page load times (with cache) of over 1.5 minutes, 500's, and lots of 404's for pages/views that I know exist...

toddgee’s picture

Priority: Normal » Critical

It's still not fixed for me either and I tried both the 'PHP 5 FastCGI' to 'PHP 5 CGI'

HS’s picture

Got the following today from Dreamhost after several trouble tickets.

We experience a network outage on the switch that your machine is connected to. This caused latency, packet loss, etc. As a result your website was either intermittently down and / or painfully slow. Everything has been resolved. One of system admins added 2GB to the switch. We have been actively monitoring the network over past few hours, and will continue to do so. Sorry for any inconvenience this has caused. We truly appreciate your continued patience. If you have any additional questions, please let us know.

toddgee’s picture

Well as of last night, my sites are working fine. I'm on ps13650. haven't received follow up from DH about all my tickets; but I guess they're busy.

Aren Cambre’s picture

Dreamhost has something called procwatch that kills PHP5 processes if they detect too much CPU or memory use. This happens on a per-process or per-user basis. So yes, that in fact could mean low tolerance for the Slashdot effect or Dugg sites despite Dreamhost's marketing materials.

Drupal is inefficient, so this could be a factor for some, especially in sites with a lot of modules.

joanpc’s picture

I installed boost in order to serve all the pages cached from the HD. Now the site runs like a real dream, only for anonymous users but for my "static" site is ok. I'm learning a little about nginx to migrate to an unmanaged VPS service in a near future.

toddgee’s picture

Status: Active » Closed (fixed)

I think it's safe to close this now.

jerdiggity’s picture

Version: 6.14 » 6.16
Status: Closed (fixed) » Active

Re-opening...

This is driving me nuts. Here's my "deal":
- 500's almost 100% of the time (when logged in)
- If it's not a 500, it's a 404
- Running a multisite install w/ custom php.ini (FastCGI)
Any special perms? Settings? Modules (besides admin menu) that may be causing this?

jerdiggity’s picture

Status: Active » Closed (fixed)
Aren Cambre’s picture

While this is closed, just wanted to report I have begun getting these errors again on Dreamhost's Hulk machine.

Aren Cambre’s picture

...and Dreamhost confirmed it's because their procwatch daemon is terminating my processes due to excessive memory use. Yet they won't tell me how much is too much due to "security" reasons. Thanks, Dreamhost!

jbergeron’s picture

I'm having this issue now. Let's see what their support tells me.

jerdiggity’s picture

Hey everyone.

FYI (in case you didn't see the other post @ #735048: "Error 500: Premature end of script headers" on admin pages) (and/or in case you care) I started a forum thread on this whole "dilemma" here:
http://drupal.org/node/862146
I'd be curious to hear what you find out @jbergeron...

HS’s picture

Issue tags: +hosting, +Web Hosting, +dreamhost.com

Ditched DreamHost. I do not recommend this host to anyone who wants to run a Drupal site.

bdornbush’s picture

I have experienced this problem with Dreamhost, especially since I migrated my largest site from D5 to D6.

What hosting company did you change to? I am looking to also ditch DreamHost, but want a better host, not just a different host. Hosts I have used and am considering include Site5 and Hostmonster.

HS’s picture

Give 1&1 a look. Holding up pretty good so far.

Aren Cambre’s picture

I migrated off 1&1 18 months ago because of extreme slowness, inexplicable email forwarding outages, and totally opaque outage notification. Has this changed?

HS’s picture

Probably the server you were on. I'm not facing the same issues. Who are you with?

trungonly’s picture

Status: Closed (fixed) » Active

I having same problem (Dreamhost, FastCGI, Drupal6x)

watchdog log: internal_error.html
raw error logs: Premature end of script headers: index.php

Note that in FastCGI, changing php_value in .htaccess does not affect.

Let's look in my .htaccess:

php_value memory_limit 128M
php_value max_execution_time 180
php_value max_input_time 180
php_value post_max_size 80M

But in phpinfo() in same directory, these settings are still in default & unchanged:
memory_limit 90M
max_input_time 60
...

Aren Cambre’s picture

@trungonly: Are you hosting several Drupal sites under one account? There's a good theory at http://drupal.org/node/862146 that you'll hit more problems with the more sites you host under one account.

DarrellDuane’s picture

I have switched to a clean Fedora 13 install on linhost due to having this problem with a VPS from Dreamhost. On Dreamhost, I over rode the php.ini settings using the instructions from their wiki and the site worked fine until I had an processor intensive user import which lead to this error.

ptoly’s picture

I've had four Drupal accounts on Dreamhost stop working in the last 5 months. Either memory errors or Gateway time-outs. I've been trying, in vain, to get Dreamhost to look into their MySQL setup, which I suspect is the culprit. These sites are all on separate shared hosting accounts, one on a basic Dreamhost VPS.

I don't think DH offers any less memory than other shared hosting setups and the Gateway time-outs are not memory problems. Until previous to five months ago I didn't have any problems with Drupal on DH, certainly not of the magnitude I've been having recently. I can't run update.php or cron.php on many of these sites.

The upshot is, that after 9 years with DH, I'm probably going to have to recommend anyone who wants cheap shared hosting and a Drupal setup (2 of the sites that I've had problems are really basic) stay away from Dreamhost until they've improved/debugged their setup, and I'll be leaving for better support myself.

Aren Cambre’s picture

Status: Active » Needs review
yasheshb’s picture

we had similar error messages on beyondhosting

[Fri Jun 24 07:45:41 2011] [error] [client 111.119.239.133] Premature end of script headers: index.php

and fixed by changing the permissions of index.php from

-rw-rw-rw-   index.php
to
-rw-r--r--   index.php
1kenthomas’s picture

To add to the grab bag: also seen with APC in combo with fcgid under Ubuntu 11-- increasing APC size above the default 30M caused more and more of these on D7 sites on a 2G server; disabling APC eliminated.

HS’s picture

I'm told that this is a memory issue and perhaps not related to one single host at all. If you're on shared hosting and have many modules installed, you're going to run out of memory. Even if you increase PHP memory, Apache (the server) also has a limit.

Create a text file called checkmem.php and put the following in it, and upload it to your server and run the file. You'll see that even if you increase your PHP memory, you'll exhaust your memory at a much lower level due to Apache restrictions.

<?php
ini_set('display_errors', 'On');
$new_mem_limit = '256M';
$old_mem_limit = ini_set('memory_limit', $new_mem_limit);
print 'Memory limit changed from '. $old_mem_limit .' to '. $new_mem_limit .'<br />';

$step = 1;
while(TRUE) {
  $chunk = str_repeat('0123456789', 1024*1024*$step++);
  print 'Memory usage: '. round(memory_get_usage()/(1024*1024)) . 'M<br />';
  unset($chunk);
}
?>
cweagans’s picture

Priority: Critical » Normal

Support requests are never major or critical.

geberele’s picture

[SOLVED]
My solution has been to change a parameter for APC in php.ini:
from
apc.shm_size 64M
to
apc.shm_size 512M

Restarting apache later everything is back to normal!

There is a a good article about APC Settings / Performance for Drupal:
https://groups.drupal.org/node/127609

thedavidmeister’s picture

Issue summary: View changes
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.