473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem serving executables with HTML out

rohswell
When my Apache installation tries to serve an executable file (web page) it gives an internal server error. I have installed and setup Apache under Cygwin under Windows XP. I am writing web pages for an embedded Linux system and using the setup above as a development/test platform. Each web page is a C program, compiled and linked to produce an executable using Cygwin and Gnu C. For example, the home page would be index.exe. When this program is executed on the Cygwin command line, it sends HTML to stdout that defines the web page. The HTML is valid per HTML 4.01 Transitional.

I attempted to configure Apache to execute all web pages as CGI scripts. Here are the significant lines from httpd.conf:

Expand|Select|Wrap|Line Numbers
  1. ServerRoot "/tools/apache"
  2. DocumentRoot "/tools/apache/htdocs"
  3. <Directory "/tools/apache/htdocs">
  4.     Options Indexes FollowSymLinks ExecCGI
  5.     AllowOverride None
  6.     Order allow,deny
  7.     Allow from all
  8. </Directory>
  9.  
  10. <IfModule alias_module>
  11.     ScriptAlias /cgi-bin/ "/tools/apache/htdocs/"
  12. </IfModule>
  13.  
  14. <IfModule mime_module>
  15.     TypesConfig conf/mime.types
  16.     AddType text/html .exe
  17.     AddHandler cgi-script .exe
  18. </IfModule>
  19.  
Apache works and serves HTML pages, but will not serve index.exe in the htdocs folder. The URL http://192.168.0.101/index.exe produces an internal server error. The error log reads:
[Tue Feb 05 09:02:56 2008] [error] [client 192.168.0.101] Premature end of script headers: index.exe

The access log reads:
192.168.0.101 - - [05/Feb/2008:09:02:56 -0700] "GET /index.exe HTTP/1.1" 500 535

Again, I know that index.exe produces valid HTML out. If I redirect its output to a file, say home.htm, then Apache will serve that HTML file just fine.

I guess I did something wrong in the config file, but I don't know what. I've read the documentation on the config parameters. I changed the ScriptAlias value from cgi-bin to htdocs because I want all the web pages in the main web folder, not in a separate place.

This is where I really struggle trying to understand. Why would CGI scripts be placed in a folder outside the main web site anyway? I also write PHP web sites served on hosted machines and I don't have to create a special folder for the PHP files.

Any help will be greatly appreciated. Thanks.
Feb 5 '08 #1
1 3043
Here's some new information.

In the config file, I commented out everything in the Alias module and left the entries for mime types. Now Apache will serve .exe files, as long as they run to completion and produce text/html out.

The problem has been narrowed to a call to shmget to access shared memory segments created by another process. Any CGI program using this shared memory method will run correctly if executed on the Cygwin command line. However, it always fails when Apache runs it.

I tried changing User to rayf and Group to None to match what I see in Cygwin. But that had no affect. So the question becomes, what is it about the Apache process that causes shmget to fail? The error reported by Apache is still "Premature end of script headers" which now makes sense because I understand the header line "Content-type: text/html\n\n" is not being sent because index.exe dies in shmget before it generates output.
Feb 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: -[ CaMeL ]- a55m0nk | last post by:
Hi there i am creating a clan website in ASP and am making a page serving script a link sends a query to the default page and then serves the page by grabbing the HTML from a database that...
53
by: Andrew Poulos | last post by:
I've got some CSS that looks like this: body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 140.01%; color: #000000; } but IE won't apply the font size to text in table...
14
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
4
by: Cott Lang | last post by:
ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1 Running 7.4.5, I frequently get this error, and ONLY on this particular character despite seeing quite a bit of 8 bit. I don't really...
2
by: hemant.singh | last post by:
I am stuck with strange JS issue My product gives user to show some images(which track mouseover) on page by embedding script like <script src=http://domain.com/GetDynamicJS?domagic=1>...
1
by: Ben | last post by:
Hi there, Perhaps someone can help me. For some reason, when my Python script runs and loads an HTML page in a new browser window at the local host (desktop), the links to my stylesheet and all...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
91
by: Eddie | last post by:
Hi I am using lcc-win on Windows 98. I'm writing a simple c console app, and I need to set the background color to blue. Here's the code I've got at the moment: _asm ( "movb $2, %ah\n" "movb...
16
by: Mathieu Maes | last post by:
I have developed a page with javascript which has a filmstrip look- alike bar and a slideshow: http://celtecbe.apache02.hostbasket.com/pdw/media.php?id=268 It uses a "onmousemove" event, which...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.