Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old May 12th, 2006, 09:05 AM
Lieven
Guest
 
Posts: n/a
Default mail function generates 500 internal server error

Hey,

I had a hard disc problem last week on my server. I replaced the disc and
copied al the files to the new hard disc, everything works fine again except
some php scripts that are using the mail() function. When executing these
scripts I get this error:
"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator, webmaster@mydomain.com and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.

More information about this error may be available in the server error log."


In my logs I find this:malformed header from script. Bad
header=/home/mydomain/dead.letter...: php-script

Does somebody know what the problem could be?

grt,

Lieven


  #2  
Old May 12th, 2006, 07:15 PM
Gordon Burditt
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

>I had a hard disc problem last week on my server. I replaced the disc and[color=blue]
>copied al the files to the new hard disc, everything works fine again except
>some php scripts that are using the mail() function. When executing these
>scripts I get this error:
>"500 Internal Server Error
>The server encountered an internal error or misconfiguration and was unable
>to complete your request.
>
>Please contact the server administrator, webmaster@mydomain.com and inform
>them of the time the error occurred, and anything you might have done that
>may have caused the error.
>
>More information about this error may be available in the server error log."
>
>
>In my logs I find this:malformed header from script. Bad
>header=/home/mydomain/dead.letter...: php-script[/color]

The program invoked by the mail() function (often sendmail) is generating
an error message, which is messing up your output since the web server
thinks it is supposed to be a CGI header, but it isn't.

Temporary workaround: output some text
(e.g. <html><head><title>This is a title</title></head><body>\n")
*before* calling the mail function. You will see the error message
text in the output from your page. Then figure out what it means.
*SOMETHING* is wrong with the mail and it's saving it in a dead.letter
file because it can't deliver it.
[color=blue]
>Does somebody know what the problem could be?[/color]

Gordon L. Burditt
  #3  
Old May 15th, 2006, 07:05 PM
Lieven
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

[color=blue]
> Temporary workaround: output some text
> (e.g. <html><head><title>This is a title</title></head><body>\n")
> *before* calling the mail function. You will see the error message
> text in the output from your page. Then figure out what it means.
> *SOMETHING* is wrong with the mail and it's saving it in a dead.letter
> file because it can't deliver it.
>[/color]
I have tried this, but I'm still receiving this error. The online line I
have in my php file is the line with the mail function.

grt,

Lieven


  #4  
Old May 15th, 2006, 07:55 PM
Gordon Burditt
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

>> Temporary workaround: output some text[color=blue][color=green]
>> (e.g. <html><head><title>This is a title</title></head><body>\n")
>> *before* calling the mail function. You will see the error message
>> text in the output from your page. Then figure out what it means.
>> *SOMETHING* is wrong with the mail and it's saving it in a dead.letter
>> file because it can't deliver it.
>>[/color]
>I have tried this, but I'm still receiving this error. The online line I
>have in my php file is the line with the mail function.[/color]

When you see the error message, then click "view source" in your
browser and paste the exact text of the error message and everything
before it into a post.

Gordon L. Burditt
  #5  
Old May 15th, 2006, 09:25 PM
Lieven
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

>[color=blue]
> When you see the error message, then click "view source" in your
> browser and paste the exact text of the error message and everything
> before it into a post.
>[/color]
This is the source code, I replaced my domain with "mydomain":
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
webmaster@mydomain.be and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr />
<address>Apache/2.0.50 (Fedora) Server at www.mydomain.be Port 80</address>
</body></html>


  #6  
Old May 16th, 2006, 02:15 AM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

Lieven wrote:[color=blue][color=green]
>>When you see the error message, then click "view source" in your
>>browser and paste the exact text of the error message and everything
>>before it into a post.
>>[/color]
>
> This is the source code, I replaced my domain with "mydomain":
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>500 Internal Server Error</title>
> </head><body>
> <h1>Internal Server Error</h1>
> <p>The server encountered an internal error or
> misconfiguration and was unable to complete
> your request.</p>
> <p>Please contact the server administrator,
> webmaster@mydomain.be and inform them of the time the error occurred,
> and anything you might have done that may have
> caused the error.</p>
> <p>More information about this error may be available
> in the server error log.</p>
> <hr />
> <address>Apache/2.0.50 (Fedora) Server at www.mydomain.be Port 80</address>
> </body></html>
>
>[/color]

Lieven,

Looks like your mail() function is aborting for some reason. I suspect it may
be taking one of the Apache processes with it.

Anything in your Apache log?

What MTA are you using, and is it running OK? I suspect this may be an in-house
system (since you talked about disk failure). Can you send mail from your email
program using the MTA on this system (not your ISP's)?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #7  
Old May 16th, 2006, 05:55 PM
Lieven
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

[color=blue]
> Lieven,
>
> Looks like your mail() function is aborting for some reason. I suspect it
> may be taking one of the Apache processes with it.
>
> Anything in your Apache log?
>
> What MTA are you using, and is it running OK? I suspect this may be an
> in-house system (since you talked about disk failure). Can you send mail
> from your email program using the MTA on this system (not your ISP's)?
>
>[/color]
I'm using sendmail. This is a server that is running a hostingsapplication
(ensim). It uses sendmail to send emails. My emailclient uses this server as
outgoing server and this is working fine, I downloaded a php class that
makes it possible to send mail by specifying a smtp sever and when I use
'localhost' as smtp server this is working fine. If I lower the security
level of a domain (this is a setting in my hostingsapplication), the mail
functions works again, but it is really unsecure to do this for all my
customers.
The only error that I find was the one I mentioned earlier, the 'malformed
header from script...'. Thnaks for your help!!

grt,

Lieven


  #8  
Old May 16th, 2006, 07:25 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

Lieven wrote:[color=blue][color=green]
>>Lieven,
>>
>>Looks like your mail() function is aborting for some reason. I suspect it
>>may be taking one of the Apache processes with it.
>>
>>Anything in your Apache log?
>>
>>What MTA are you using, and is it running OK? I suspect this may be an
>>in-house system (since you talked about disk failure). Can you send mail
>>from your email program using the MTA on this system (not your ISP's)?
>>
>>[/color]
>
> I'm using sendmail. This is a server that is running a hostingsapplication
> (ensim). It uses sendmail to send emails. My emailclient uses this server as
> outgoing server and this is working fine, I downloaded a php class that
> makes it possible to send mail by specifying a smtp sever and when I use
> 'localhost' as smtp server this is working fine. If I lower the security
> level of a domain (this is a setting in my hostingsapplication), the mail
> functions works again, but it is really unsecure to do this for all my
> customers.
> The only error that I find was the one I mentioned earlier, the 'malformed
> header from script...'. Thnaks for your help!!
>
> grt,
>
> Lieven
>
>[/color]

Lieven,

Did you try asking the authors of the PHP class? Not knowing what it does (or
even which class it is) makes it impossible to tell what's going on.

Does a simple mail() command work? That would be the place to start if you're
asking in this group.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #9  
Old May 16th, 2006, 07:55 PM
Lieven
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

[color=blue]
>
> Lieven,
>
> Did you try asking the authors of the PHP class? Not knowing what it does
> (or even which class it is) makes it impossible to tell what's going on.[/color]
This script is just the normal phpmailer
(http://phpmailer.sourceforge.net/), there you can specify that you want to
use smtp like this:
$mailman = new PHPMailer();

$mailman->IsSMTP();

Using this tool, sending mails from our php scripts works, but it is
impossible to ask all our customers to change their php scripts.[color=blue]
>
> Does a simple mail() command work? That would be the place to start if
> you're asking in this group.[/color]

No, that is the whole problem. The mail function doesn't work anymore. After
a hard disk crash I copied the whole corrupt hard disk to a new disk,
everything else is working perfectly afterworths except php scripts that are
using the mail() function are getting the internal server error. I didn't
change anything to my configuration files or didn't update any application
on the server. Only raisonable explenation I have is that their must be some
kind of file corrupt after copying it to the new disk.

grt,

Lieven[color=blue]
>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================[/color]


  #10  
Old May 16th, 2006, 08:05 PM
Rik
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

Lieven wrote:[color=blue]
> No, that is the whole problem. The mail function doesn't work
> anymore. After a hard disk crash I copied the whole corrupt hard
> disk to a new disk, everything else is working perfectly afterworths
> except php scripts that are using the mail() function are getting the
> internal server error. I didn't change anything to my configuration
> files or didn't update any application on the server. Only raisonable
> explenation I have is that their must be some kind of file corrupt
> after copying it to the new disk.[/color]

I'd say, allthough a terrible job, back up settings and files, and install
everything as new. Who knows what else has become corrupt, that you just
haven't found out? It could be a simple function that doesn't work, it could
you're having a major security risk somewhere.

Grtz,
--
Rik Wasmus


  #11  
Old May 16th, 2006, 09:55 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

Lieven wrote:[color=blue][color=green]
>>Lieven,
>>
>>Did you try asking the authors of the PHP class? Not knowing what it does
>>(or even which class it is) makes it impossible to tell what's going on.[/color]
>
> This script is just the normal phpmailer
> (http://phpmailer.sourceforge.net/), there you can specify that you want to
> use smtp like this:
> $mailman = new PHPMailer();
>
> $mailman->IsSMTP();
>
> Using this tool, sending mails from our php scripts works, but it is
> impossible to ask all our customers to change their php scripts.
>[color=green]
>>Does a simple mail() command work? That would be the place to start if
>>you're asking in this group.[/color]
>
>
> No, that is the whole problem. The mail function doesn't work anymore. After
> a hard disk crash I copied the whole corrupt hard disk to a new disk,
> everything else is working perfectly afterworths except php scripts that are
> using the mail() function are getting the internal server error. I didn't
> change anything to my configuration files or didn't update any application
> on the server. Only raisonable explenation I have is that their must be some
> kind of file corrupt after copying it to the new disk.
>
> grt,
>
> Lieven
>[color=green]
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstucklex@attglobal.net
>>==================[/color]
>
>
>[/color]

Well, it's always possible a file got corrupted. Especially since you copied
files from a corrupt hard disk.

At this point I agree with Rik - you need to reinstall at least sendmail, php
and apache for a start. You should be able to keep your configuration files
(after ensuring they aren't corrupt), but get the rest of the files installed
with fresh copies.

Otherwise you may be spending days trying to find this bug - and even when you
find it, you wouldn't know if you might have another (more serious) bug.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #12  
Old May 18th, 2006, 12:25 PM
Lieven
Guest
 
Posts: n/a
Default Re: mail function generates 500 internal server error

[color=blue][color=green]
>>
>>
>>[/color]
>
> Well, it's always possible a file got corrupted. Especially since you
> copied files from a corrupt hard disk.
>
> At this point I agree with Rik - you need to reinstall at least sendmail,
> php and apache for a start. You should be able to keep your configuration
> files (after ensuring they aren't corrupt), but get the rest of the files
> installed with fresh copies.
>
> Otherwise you may be spending days trying to find this bug - and even when
> you find it, you wouldn't know if you might have another (more serious)
> bug.
>
>[/color]
Ok I think this will be indeed the right solution. I will reinstalled it and
I hope it will be fixed afterwards. Thanks for the support!!

grt,

Lieven


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.