Filefield was working great about a week ago for me, and then all of a sudden it started spitting out a HTTP 500 server error when trying to submit a node with a file uploaded to it.

The only think I could think of that change from when this started happening was that I updated panels b3 to panels b4 and then to panels b5 and had to do some update.php scripts. But I don't see how this is could be related to my problem.

~Wes

Comments

wescoughlin’s picture

Could this be a bug relating to memory usage?

wescoughlin’s picture

Maybe I should mention that the file uploads correctly using the Filefield, but upon submission of the node thats when the 500 error occurs. Also, the core file attach module works perfectly still, just the Filefield module is causing me some pain.

jpetso’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, I have no idea what could cause a 500 server error with filefield, nor have I encountered such a situation yet. In any case, 500 server error could be *anything*, so you'd better look up in your server log what the actual error is. Perhaps that can guide you towards a solution. (Changing to "needs more info" until the exact error is being posted here, as nobody will be able to help otherwise.)

wescoughlin’s picture

Hey thanks for the response. I actually requested support from my hosting provider to view my logs before you posted, but I finally found out that I had access to them already.

Here is the error that I'm receiving

Premature end of script headers: /hsphere/local/home/pbcoughlin/test.greenbuilderswholesale.com/cgi-bin/php5-cgi

wescoughlin’s picture

Coming back to my question after a long break...and here is what I have learned so far.

Since I'm not an yet an expert at solving errors, I started from scratch again and build the site back up from scratch. Installed filefield --> uploaded a file --> submitted the node --> got 500 error once again.

This error did only only occur on the submitted node, but also occurs every time that I try to access mysite.com/admin

So I obviously removed the filefiled module and cck field that was associated with it, but the 500 error at mysite.com/admin was still occurring.

I decided to start emptying my mysql cache tables, and found out that when ever I empty the cache_menu tables the 500 error goes away at mysite.com/admin. But it still appears once the cache is reset and the page is refreshed again.

So I figure there might be something with the cache_menu tables that keeps triggering a "Premature end of script headers" but I really don't know beyond this.

dopry’s picture

no clues... with 2.3-rc4? have you tried the 2.3 release?

dopry’s picture

how is your filefield configured? What additional modules are you using with filefield? are there errors in your watchdog? do you have any debugging information to share at all?

wescoughlin’s picture

how is your filefield configured?
--When I did have my filefield installed it was configured to allow multiple values and excepted file types where only "pdf". The filefield was also placed within a group so I could use panels to place the cck field where I wished.

What additional modules are you using with filefield?
--CCK with defualt cck fields enabled, imagecache, imagefield, imagefield gallery, lightbox, mimedetect (dependent), and panels

are there errors in your watchdog?
--No there are no errors in my logs/watchdog list

do you have any debugging information to share at all?
--Yes, after using the filefield module I receive a "premature mature ending of script headers" in my php-cgi file. This error occurs after the node is submitted, at mysite.com/admin and mysite.com/admin/logs/status

wescoughlin’s picture

UPDATE:

I kind of already new that this issue was probably more of a web server issue than a Drupal issue, but through some more trial and error have came to the conclusion that the "mimedetect" module (the dependent for the filefield module) was the one triggering the errors for my site.

I appreciate all the responses that were made trying to help me out.

Thanks,

Wes

dopry’s picture

Project: FileField » MimeDetect
Version: 5.x-2.3-rc4 » 5.x-1.0

did you get a specific error in the apache error logs? How did you discern that mime detect was failing?

wescoughlin’s picture

Well since I'm not an expert at debugging yet, the only reason I say that mime detect was causing my 500 error because when ever I enable/disable the module the internal 500 error went away and came back.

Also when running the website locally, I saw in my status log that mime detect had a caution sign and said

"MimeDetect is using the browser supplied mime type or file extension lookups. It is strongly recommended that you install and configure the PHP FileInfo Extension or the UNIX 'file' command to provide more accurate severside mime type detection."

I'm not sure if this was the "error" or setup problem that was causing my shared hosting environment to poop out.

aussieman’s picture

Title: 500 server error after uploading file & submit » 500 server error at admin/logs/status
Status: Postponed (maintainer needs more info) » Active

Hello!
I've got 500 error at provider's server too.

It using suPHP, so maybe problem is there.
Im installing fresh drupal instance, and its enough to install mimedetect module to get 500 error at admin/logs/status!

Any ideas where i should go?)

Update:
If im using drupal localization language - problem persist. When i swithing off all localizations (except english one) - i've got no 500 error at all! Nowhere!

featherbelly’s picture

Hi,

I was having the same problem and tracked it down to the following line:

    if ($finfo || $finfo = @finfo_open(FILEINFO_MIME, drupal_get_path('module', 'mimedetect') .'/magic')) {
        $mime = finfo_file($finfo, $file->filepath);
    }

If you remove the path to the custom 'magic' file then it will revert to the default magic path - 'mime_magic.magicfile' set in php.ini.

This may well solve your problem - it was the custom magic file that was throwing an error on the production server (although everything was working fine locally).

I don't know too much about how to debug the magic database itself...

This is the alternative code:

    if ($finfo || $finfo = @finfo_open(FILEINFO_MIME)) {
        $mime = finfo_file($finfo, $file->filepath);
    }

Obviously it would be better to fix the bug in the magic file - it was causing a segmentation fault on my production server.

Cheers!

clement006’s picture

Version: 5.x-1.0 » 6.x-1.2

Thank you featherbelly, I finally managed to activate mimedetect module correctly (in Drupal 6) with your help...
I also received "Segmentation fault" all the time...

Well, to help people avoiding hours to loose, here is my working procedure:

- first search in your system where the default magic file is located, mine was here /usr/share/misc/magic (OpenSUSE 10.2)
- de-activate mimedetect module if it is not the case already
- uninstall the module (?q=admin/build/modules/uninstall) - this is important
- edit mimedetect.install file, and replace:
if (!$finfo = @finfo_open(FILEINFO_MIME, drupal_get_path('module', 'mimedetect') .'/magic')) {
with:
if (!$finfo = @finfo_open(FILEINFO_MIME, '/usr/share/misc/magic')) {
- edit mimedetect.module file, and replace:
$magic_file = drupal_get_path('module', 'mimedetect') .'/magic';
with:
$magic_file = '/usr/share/misc/magic';
- re-activate the module, and now it works!

;-)

kewlguy’s picture

I wonder, if one looks inside the MimeDetect module readme.txt if they might find the instructions to add the 'magic' file location to the config.php?

Just a thought before attempting the #14 response. If I used the #14 method then I would be required to redo the config changes every time the module changes, that might be a pain.....

Using the config settings for the location of the magic file would prevent having to make the change to the module as described in #14.

clement006 Nice work figuring out another method for sorting out this issue!

manuel.adan’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Assumed fixed. If not, please, reopen it.