Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 23rd, 2002, 03:39 AM
shajudavis shajudavis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 5 shajudavis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Newbie:Error While Accessing a C file through Apache

Dear

I am trying to access a C file through Apache

But I am getting the error "HTTP 500 Internal Server Error"
while i am accessing it through "www.mydomain/cgi-bin/Test"

The following is the Simple C Code (Test.c) that I am trying to access

#include<stdio.h>
int i;
main() {
printf("Content-type: text/html \n");
printf("<html><head><title>Testing C Through Apache</title></head> \n");
printf("<body>Hello World!!</body></html> \n");
}

I same code is running sucessfully from the console after I compiled and executed it.

The permissions of the "cgi-bin" directory and the C file are correct (755) and all the Perl scripts in that same "cgi-bin" directory is working properly.

This is the Directory tag inside the Virtual Host also I have specified the ScriptAlias tag

<Directory "/home/www/users/mydomain/cgi-bin/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
AddHandler cgi-script .pl .cgi .exe
</Directory>

Need I add anything for the C script to run through Apache.

Please Help !!

Reply With Quote
  #2  
Old January 23rd, 2002, 08:06 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
1) I mentioned this dozen times a day, when your cgi-bin is ScriptAlias'ed, you don't set any option to it. So change the Options to None.

2) A <Directory> directive cannot have any trailing slash on the path.

3) You don't need to define AddHandler within <Directory>.

4) Your ScriptAlias line should be ScriptAlias /cgi-bin/ "/home/www/users/mydomain/cgi-bin/"

Reply With Quote
  #3  
Old January 23rd, 2002, 10:30 PM
shajudavis shajudavis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 5 shajudavis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dear

I made the changes that were mentioned above but still I am not able to run my C Script.

The Perl program in the "cgi-bin" directory is executing properly.

Problem is only for the C Program.

Reply With Quote
  #4  
Old January 24th, 2002, 12:19 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If you already made the changes then that's it for Apache. All I have to say is that, CGI can be written in any language, not just Perl. And you can run your compiled C code as a CGI.
As far as what caused you the 500 error (catch-all error which tells nothing), you'll know better than us by enabling ScriptLog directive. For example:

ScriptLog /var/log/apache/script_log

Note, this script_log needs to be writable by the User Apache runs as.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Newbie:Error While Accessing a C file through Apache


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT