Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Internal server error

Status
Not open for further replies.

rebayona

Technical User
Oct 22, 2001
32
0
0
CO
Hi, I just started apache for the first time, and it seems to be working alright. If I go to correo.setecsa.com I can see the "test page", so it sounds good. Now I want to test some scripts. I just installed them on the cgi-bin directory, but the "500 internal server error" arises.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@setecsa.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.
--------------------------------------------------------------------------------

Apache/1.3.19 Server at _default_ Port 80


I can't even open the same "index.html" file on that directory, so it seems to be a permissions matter. Checking the error_log file this is the result:

[error] (8)Exec format error: exec of /var/ failed
[error][client 200.74.XXX.XXX] Premature end of script headers: /var/
Or trying to open other file:

[error] (13)Permission denied: exec of /var/ failed
[error][client 200.74.XXX.XXX] Premature end of script headers: /var/
And if I run a cgi, I only can see the code or a blank page (check if you want)

So, what is wrong here? I think it should be a silly thing, but don't forget I'm a newbie ......

Thanks a lot,

Rafael
 
Make sure these lines are in your /etc/httpd/httpd.conf file and uncommented:

ScriptAlias /cgi-bin/ "/var/
<Directory &quot;/var/ AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

You can also uncomment:

AddHandler cgi-script .cgi .pl

This will allow you to use cgi scripts outside the cgi-bin directory. I had this problem a while back and it was caused from copying files from my windows partition over to linux. I had all kinds of cariage returns where there shouldn't have been. Let me know how things turn out and what system you are running so I can help you out a little more.
 
Thanks for the reply

Nothing changed, I uncommented the addhandler line, restarted httpd service, but nothing happened. Note that I can see correo.setecsa.com/ , but not correo.setecsa.com/cgi-bin/index.html so it doesn't seem to be a cgi or executing problem, but a permissions matter.

I checked and the directories and files in mention are set to 755

Thanks for reading,

Rafael
 
When you use the directive 'ScriptAlias', apache will serve any document in that directory as a cgi script regardless of the extention. This COULD cause the 'unexpected end of header' error. If you enter the line 'use CGI' right after the shabang (the next line after #!/usr/bin/perl/ )in your scripts this should let you run the scripts until you find the problem. You might also want to check to see if 'cgi' and 'pl' are defined in your mime types. Just on the outside chance that you really do have a permissions error, and assuming they are correct, you might want to check the owner and group. The reason I say outside chance is because you are not getting a permission denied error. One more thing I can think of is that I noticed you have a subdomain name. Is this set up as a virtual host on your server? If it is, you have to duplicate the cgi-bin and document root (html) directories within the virtual host container. They can't be defined globally.

 
Have you got the following line in your cgi-script

print (&quot;Content-type:text/html\n\n&quot;);

This will allow the content of your cgi-script to be parsed by the browser - also if you are intending to have output in your cgi-script are you sure your have the relevant html tags i.e print &quot;<HTML>&quot;; etc...

jim
 
Well RythmAce, I checked the permissions on the directories, and something weird appeared to me, the owner and the group for the directories /etc, /etc/ /etc/ is root, but for the application that I'm trying to setup (which, by the way, is a cgiscript called mailreader-2.3.29) the group and the owner is &quot;1000&quot;

Will it have something to do with the problem?

Thanks for your time,

Rafael
 
Not really. That's where the permissions come in. If the script calling the file is not the owner then you can set &quot;other&quot; to read, write, execute or any combination of the three. If that doesn't work, you might look at you users and see if 1000 is a valid user on your system.
 
I just checked and 1000 is not a valid group, neither a valid user ID. But I don't see relation, since in /var/ (where the owner is root) there's a file named &quot;index.html&quot;, and the owner is root as well. Index.html is not a script, is just a plain html file, (a copy of the index.html in the /var/ which displays a normal page), but here the result is the infamous &quot;500 Internal server error&quot; message.

Just to sumarize: (and if you want to give it a try)

displays a test page
displays
Forbidden
You don't have permission to access /cgi-bin/ on this server.
displays
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@setecsa.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.

Checking the log file results on:
(8)Exec format error: exec of /var/ failed
[client 200.74.XXX.XXX] Premature end of script headers: /var/[client 200.74.XXX.XXX] attempt to invoke directory as script: /var/
And when I try to execute a script:


Displays nothing

Changing in the script the line #!/usr/bin/perl for #!/usr/bin/perl/ as somebody suggested:

ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: [no URL]
The following error was encountered:
Zero Sized Reply
Squid did not receive any data for this request.
Your cache administrator is root.
--------------------------------------------------------------------------------
Generated Thu, 06 Dec 2001 03:57:59 GMT by ns1.setecsa.com (Squid/2.3.STABLE4)

Messy, huh?

Thanks for your time,

Rafael
 
Hi Guys, I'm still stuck here, anybody willing to help?

Thanks!

Rafael
 
Well, this may not help, but we run Apache Web Server with PeopleSoft and occassionally based on server activity we also receive an &quot;Internal Server Error&quot; exactly as you stated. After speaking with PS, they suggested that we load more JVMs. I'm definitely not a web person, but that was our experience. Apparently they are saying that we need more JVMs that load when we start Apache. Hope that helps in some way.
 
Not really lory, as if I'm not wrong, JVM is the acronym for Java virtual machine? But I'm not doing anything related to Java, I'm trying to just to set up apache for the first time, and I can't

Thanks anyway for your reply,

Rafael
 
OK rebayona, let's put this puppy to bed once and for all. Do you have a clean httpd.conf file? One that hasn't been edited to smitherines. I'm thinking that we're overlooking something simple here (the silly thing you refered to). If you've done everything to enable CGI in httpd.conf and it's still not working. The server configuration error has to be the link is not correct. This can be caused from 3 things, 1) Path to the cgi file contains a typo. (unlikely unless you keep typing the same mistake) 2) improper use of the slash at the end of the container path in httpd.conf. (did ya double check?) 3) Directory structure on your HD is different from what you have defined in httpd.conf. If you've double checked everything and there is no doubt that it is correct, the the problem is in the configuration of the script. For example, I noticed that you have a cgi-bin under your mailreader sub-directory which in turn is under your cgi-bin directory. This is fine since all sub-directories under your main cgi-bin will have the same properties. You just need to make sure your path info is correct in your scripts configs. Let's see if this takes care of the problem, if not, we will at least be able to narrow some things down. Good luck.
 
Hi RhythmAce, thanks for you reply.

I overwrote the httpd.conf with a &quot;pristine&quot; copy I made before starting to mess with it.
About your &quot;checklist&quot;:
1. Path to the file is correct.
2. There were improper slashes at the end of the container path on some lines refereing to /var/ That was fixed. (I'm curious, why some lines have the / at the end, and some doesn't?)
3. Directory structure is OK. /var/ the correct path, and that is stated on httpd.conf

About the possible script problems, I think this is not that important for now, since I can't even open an HTML file under the cgi-bin directory, and I guess it's a sign of there's something wrong here, and I insist it must be the silliest thing. So, if you want to take a look to the httpd.conf file, you can see it on
So, that's it for now, thanks for the support guys, I love tek-tips!

Rafael
 
Holy smokes what a mess!!. I'll tell you what I'll do. I'll make one up for you and post it here so you can copy and paste it into a new httpd.conf file or what ever you want to save it as. It would be faster that way. You have a lot of things defined twice (or more) and others in the wrong order. I will try to get it for you tonight.
 
Ok - This file should work for you the way it is. If you have to edit it, use a text editor like gedit or something. Linuxconf or apache configurator will mess it up. Copy and paste it to &quot;httpd.conf.txt&quot; this is your backup. Then copy it to your httpd.conf file. The file is at: Good luck.
 
Hi, I had this problems, but commenting the lines involved, make the server to start:

Dec 19 10:20:01 ns1 kernel: hda: ATAPI 10X CD-ROM drive, 256kB Cache, DMA
Dec 19 10:20:01 ns1 kernel: Uniform CD-ROM driver Revision: 3.12
Dec 19 10:20:09 ns1 httpd: Syntax error on line 211 of
/etc/httpd/conf/httpd.conf:
Dec 19 10:20:09 ns1 httpd: Cannot load /etc/httpd/modules/mod_throttle.so
into server: /etc/httpd/modules/mod_throttle.so: undefined symbol:
shm_open
Dec 19 10:20:09 ns1 httpd: httpd startup failed
Dec 19 10:22:15 ns1 httpd: httpd shutdown failed
Dec 19 10:22:17 ns1 httpd: Syntax error on line 289 of
/etc/httpd/conf/httpd.conf:
Dec 19 10:22:17 ns1 httpd: Cannot add module via name 'mod_throttle.c':
not in list of loaded modules
Dec 19 10:22:17 ns1 httpd: httpd startup failed
Dec 19 10:22:49 ns1 httpd: httpd startup succeeded

But, it's still happening exactly the same thing! :(
 
OK, It's not easy to write this.

It was OK ALL THE TIME!!!

It was MY mistake. server.cfg, the config file for mailreader had a typo. It was copied from an example file, from the distribution, but it had a path to: /var/ (and like 10 more like this one). BUT, the correct path was /var/ !!!!

So, I have to apologize with all of you for wasting your time!

Now it works, but not fine at all. I'll need your help here, as I have errors and this cgi it's not very well documented:

- make sure cgi-bin and gfx are visible through the http server,

(I guess it is OK, since I can see it)

other directories can be placed somewhere else
- edit cgi-bin/server.cfg to suit your configuration
(rename server.cfg.example to server.cfg first)

DONE

- make sure logs/, smtp/, temp/, cache/ and cgi-bin/ are writable by
the httpd daemon and that smtp/, temp/ and cache/ cannot be read
with a browser (a simple .htaccess will do)

NO IDEA ON HOW TO DO THIS, must be the cause for the errors.

- point your browser to cgi-bin/nph-mr.cgi and off you go...

THAT'S WHAT I DO, and it works, but HOW DO I POINT CORREO.SETECSA.COM TO THAT PATH? (I mean, just writing will lead me to that path?)

I guess that's it for now, thanks again guys, and I'm very sorry for wasting your time

Rafael
 
Hi,









I got this working inside a test virtual host container like this :









<VirtualHost *>




UseCanonicalname off




ServerName



ServerAlias vhost1.xxxxxxx.com *.vhost1.xxxxxxx.com




DocumentRoot /var/



ScriptAlias /cgi-bin/ &quot;/var/



<Directory &quot;/var/



AllowOverride None




AddHandler cgi-script cgi pl




Options ExecCGI




Order allow,deny




Allow from all




</Directory>









</VirtualHost>









(Its kind of hard to test things outside vhost containers once you are using them !)









The above would be reached by :


You will note that I don't have one cgi-bin as a subdirectory of another as that seems too confusing. Anyway, the key bit is that you have a <Directory> container for the mailreader cgi-bin directory that has the directives :









AddHandler cgi-script cgi pl




Options ExecCGI









I find that without another 'Addhandler' in a directory container the cgi-bin doesn't work despite ExecCGI being there.









Hope this helps
 
It looks like you're pretty close to being there Rafael. Your mailreader program needs read , write and execute permission to all those directories. You can do that with your filemanager or with chmod. Now the problem is, someone with the same program will know where all your files are and can hack into your system because you just gave the world permission to write to all you files. What .htaccess does is make sure that if anybody enters any of those directories, they will have to enter a valid name and password. You won't need .htacces for the mailreader's /html directory because you want people to go there with out typing a name and password. I don't use .htaccess but I'm sure someone here can tell you what files you need, what goes in them and where to put them. (in a new thread maybe?) Your programs config file may ask for the url and path to its scripts directory, the URL is The PATH would be /var/ This is an example based on the info you provided. You may have to change it to what ever directory you have to point to.
 
Thanks rythmace, I changed the directory and everything works fine now. Thanks for your support, it was really helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top