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?






 
karnovskAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
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
Michel PlungjanIT ExpertCommented:
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
Michel PlungjanIT ExpertCommented:
when clicking on the index
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

ZvonkoSystems architectCommented:
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

Michel PlungjanIT ExpertCommented:
It is so strange that so many sites do not handle the domain name without www
karnovskAuthor Commented:
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
Michel PlungjanIT ExpertCommented:
post a question in community support and ask them to PAQ and refund, please
jaysolomonCommented:
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
moduloCommented:
PAQed, with points refunded (500)

modulo
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.