Link to home
Start Free TrialLog in
Avatar of karnovsk
karnovsk

asked on

Included JavaScript causes "Premature end of script headers"

My web page, top.html, includes the following line:

<SCRIPT LANGUAGE="JavaScript" SRC="../cgi-bin/putdisplay.js"></SCRIPT>

Now there are two ways to call top.html, without or with subdomain. Without subdomain,  the URL is

http://www.dralex.com/albumwizz/hike/top.html

and everything works nicely.

If I call the same top.html using subdomain:

http://albumwizz.dralex.com/hike/top.html,

I get the following error message, "Premature end of script headers: /home/dralex2/public_html/albumwizz/cgi-bin/putdisplay.js". In that case, top.html is displayed correctly, but the JavaScript is not included.

Any ideas?






 
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

That is because the js files are not found and return

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<p>
Please contact the server administrator,
 wwwadmin@dralex.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<p>
More information about this error may be available
in the server error log.<p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
<hr>
<address>Apache/1.3.27 Server at albumwizz.dralex.com Port 80</address>

</body></html>

which is invalid
and later I get
Error: parent.frames.topFrame has no properties
Source File: http://www.dralex.com/albumwizz/cgi-bin/putdisplay.js
Line: 62

and Line 10

on the first url
when clicking on the index
If you open http://albumwizz.dralex.com/ you will see that nothing is working correctly.
Repair that virtual server configuration first.
Afterwards should be your JavaScript included correctly for both domain names.

Good luck,
Zvonko

It is so strange that so many sites do not handle the domain name without www
Avatar of karnovsk
karnovsk

ASKER

Well I think I have the answer.

Apparently, the web server is configured so that each top level cgi-bin directory can contain only CGI files. Whatever file it meets, be it .js or .gif, it attempts to execute it.  All .htaccess settings are ignored. That's what happens when I use the subdomain, http://albumwizz.dralex.com: cgi-bin becomes a top-level directory. Hence all the "Premature end of script headers." messages.

When I don't use subdomain, i.e. use URL http://www.dralex.com/albumwizz, cgi-bin becomes a lower-level directory, and my .htaccess setings start working.

Therefore, the practical solution was to move out all non-executable files out of cgi-bin. It worked!


Best regards and thank you all for your efforts.

Alex
post a question in community support and ask them to PAQ and refund, please
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial