LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-19-2007, 09:40 AM   #1
bship
LQ Newbie
 
Registered: Mar 2005
Location: NC
Distribution: Red Hat and Novell OES (formerly SUSE), LPI 101 and Net+
Posts: 25

Rep: Reputation: 15
500 Internal Server Error


Ok, first I apologize as I didn't do anything. Really!
Neither did our client, at least he said he didn't.

The client advised...
That his RH box is no longer sending email from scripts on the box. They have several scripts that send email,
and mysteriously all of them stopped working a couple days ago. Now he's getting a "500 Internal Server Error".

I have looked around on the box, and he has strange locations for some things. Web dir /home/domain.com/data
Log files are in a strange location, too. Also, he deleted an .htaccess and an .htpasswd file from a directory.

I told him that this was not an e-mail problem, but appeared to be Apache. All the help that I have found on the web says that it is a CGI/scripts problem.

So where do I start, not being a script person.

My problem is that I can use and config RH, but I'm a bit weak with troubleshooting apps. on RH.

Any and all help will be greatly appreciated.

Much Appreciation,
Beth

Last edited by bship; 01-24-2007 at 08:44 AM.
 
Old 01-19-2007, 02:41 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,996

Rep: Reputation: 302Reputation: 302Reputation: 302Reputation: 302
Quote:
That his RH box is no longer sending email from scripts on the box.
Since you said scripts, emphasis on plural, it would be something that is common to all these scripts. I do not believe the claim that "nothing has been changed". Yes, something has changed, and your job is to find out what!

First, check out Apache's error_log file for the cause of the 500 error. Since you said things were installed in weird places, you're on your own to find Apache's logfiles and if the error file is even named "error_log" or something else.

My guess is that once you find error_log, you'll see the cause of the 500 error is "premature end of script headers". 99% of the time, this is what I've run into. Usually it means your script died before completing output of the webpage it was trying to generate.

Quote:
I told him that this was not an e-mail problem
This certainly could be related to an email problem. If the problem script(s) try to send email, and THEN output the webpage, they could be choking on the sendmail part, aborting, and causing the premature end of script headers errors.

Of course I'm just guessing at your errors, and suggesting possibly causes of those assumed errors. Big assumptions! With a little more detail someone might be able to offer something better than generic help. Good "detail" would be specifics from the error_log, and the results of running one of these problem scripts manually (not via Apache).
 
Old 01-19-2007, 02:59 PM   #3
bship
LQ Newbie
 
Registered: Mar 2005
Location: NC
Distribution: Red Hat and Novell OES (formerly SUSE), LPI 101 and Net+
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks 4 your help.
So the box is running qmail.
I've been thru the httpd config and nothing has changed and the directives look OK.
After running history, I saw that the user removed .htaccess and .htpasswd
Could that have caused this problem?

I've looked at the logfiles and here are the 2 lines that occur over and over...
[Thu Jan 18 23:05:05 2007] [error] [client IP REMOVED FOR SECURITY] DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 at GNS/Store.pm line 804, <IN> line 910.
[Thu Jan 18 23:05:05 2007] [error] [client IP REMOVED FOR SECURITY] DBD::mysql::st fetchrow_hashref failed: fetch() without execute() at GNS/Store.pm line 807, <IN> line 910.

If I search on the Premature string I get this...
[Fri Jan 19 14:37:39 2007] [error] [client IP REMOVED FOR SECURITY] Premature end of script headers: page.pl, referer: WEB ADDRESS REMOVED FOR SECURITY

One more thing, there is a cgi-bin dir w/nothing in it.
The upload.cgi is sitting in /home/domain.org/data/realaudio
Is that weird?
I did run the above script in that dir and did not receive an error.

Thx and Much Appreciation,
Beth

Last edited by bship; 01-19-2007 at 03:29 PM.
 
Old 01-19-2007, 03:45 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,996

Rep: Reputation: 302Reputation: 302Reputation: 302Reputation: 302
Quote:
Originally Posted by bship
[Thu Jan 18 23:05:05 2007] [error] [client IP REMOVED FOR SECURITY] DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 at GNS/Store.pm line 804, <IN> line 910.
[Thu Jan 18 23:05:05 2007] [error] [client IP REMOVED FOR SECURITY] DBD::mysql::st fetchrow_hashref failed: fetch() without execute() at GNS/Store.pm line 807, <IN> line 910.
You've got some script that is trying to do a database access to your MqSQL database. This script is trying to run a bad (incorrect syntax) SQL statement. I do not know where that statement is coming from (internally hardcoded? passed into the script from outside?) You've got bad SQL, and Store.pm tries to run execute() on it. That fails. Then Store.pm tries to do a fetch(), which of course fails because the previous execute() failed. Store.pm should really check the return value from execute(), but obviously it doesn't, and just runs a blind fetch() that is doomed to fail. Not the worst thing in the world, but somewhat sloppy programming.

This MySQL issue may or may not be related to you 500 error problem. I say this because your MySQL error examples are dated Jan 18th, and your "premature end of script header" error example is dated Jan 19th. Were the MySQL errors causing the header error, I'd expect them to be coupled closely together in the logfile.

Quote:
[Fri Jan 19 14:37:39 2007] [error] [client IP REMOVED FOR SECURITY] Premature end of script headers: page.pl, referer: WEB ADDRESS REMOVED FOR SECURITY
Now THIS will definitely case a 500 error. You have a script named "page.pl" that is having the problem. I'd try running page.pl manually from the commandline and see what happens. It may be expecting parameters so running it manually may prove not as simple as it seems. When you run it, you should see valid HTML spit out to the screen. And BEFORE that HTML, you should see "Content-type: text/html" followed by a blank line. These specifics may change based on your situation, but this is typically what I'd expect to see from page.pl without knowing anything else about it.

Quote:
One more thing, there is a cgi-bin dir w/nothing in it.
The upload.cgi is sitting in /home/domain.org/data/realaudio
Is that weird?
Not really. You can configure httpd.conf so that CGI only runs out of cgi-bin, or you can open things up and allow it to run from other places.
 
Old 01-19-2007, 04:17 PM   #5
bship
LQ Newbie
 
Registered: Mar 2005
Location: NC
Distribution: Red Hat and Novell OES (formerly SUSE), LPI 101 and Net+
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks a million.

You are right, they are related. I just pulled 2 dates to check things, but upon a full search on today's date, they are indeed together the 2 SQL errors come before and after the premature error.

Quote:
Originally Posted by haertig
This MySQL issue may or may not be related to you 500 error problem. I say this because your MySQL error examples are dated Jan 18th, and your "premature end of script header" error example is dated Jan 19th. Were the MySQL errors causing the header error, I'd expect them to be coupled closely together in the logfile.
I will let my boss know what you have found, and hand it off to programming and development.

PS-Could the deletion of the .htaccess and .htpasswd caused any of these problems?

Much Appreciate and Keep up the good work.

Beth
 
Old 01-19-2007, 04:48 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,996

Rep: Reputation: 302Reputation: 302Reputation: 302Reputation: 302
Quote:
Originally Posted by bship
PS-Could the deletion of the .htaccess and .htpasswd caused any of these problems?
No. With these two files, you would have had basic authentication. i.e., you would have had the ability to limit who could access certain webpages. How limiting you would be depends on how you configured things in your .htaccess file(s). Note: "basic authentication" is called basic for a reason. You certainly shouldn't depend on it to protect anything really valuable.

Anyway, by removing these files you simply got rid of any basic authentication you might have had (however feable it may have been). So you potentially "opened up" some files on your website that may have been restricted to certain people/incoming_computers before. This may raise a security issue for you, but it wouldn't cause a 500 error.

Functionally, removing .htaccess did something akin to this:
Code:
$ ls -l
total 0
-rwxr-xr-x  1 haertig haertig 0 2007-01-19 15:39 somewhat_protected_file

$ mv somewhat_protected_file totally_unprotected_file
$ chmod 777 totally_unprotected_file

$ ls -l
total 0
-rwxrwxrwx  1 haertig haertig 0 2007-01-19 15:39 totally_unprotected_file
$
You just opened up access to something that had minor protections in place originally. No 500 error would be caused by this. Paradoxically, some 500 errors could be fixed by running a wide-open chmod command, but that's a bad thing to do from a security standpoint!
 
  


Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
500 Internal Server Error/Premature end of script headers baruah Linux - Software 1 04-01-2006 05:10 PM
Additionally, a 500 Internal Server Error error was encountered while trying to use a ukrainet Linux - General 10 06-24-2005 02:23 AM
Internal Error 500 cannot be fixed cpanelskindepot Linux - General 1 10-25-2004 12:46 PM
HELP! CGI problem : HTTP 500 - Internal server error eech55 Programming 2 10-11-2004 11:27 AM
dns and 500 internal server error.. Flawless Slackware 4 08-23-2003 11:08 PM


All times are GMT -5. The time now is 04:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration