GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Oct-2003, 23:27
DustinDavis DustinDavis is offline
New Member
 
Join Date: Oct 2003
Posts: 2
DustinDavis is an unknown quantity at this point
Angry

Hello world as a CGI under linux/apache, GRRR!


I'm trying to get a simple hello world program to run as a cgi application on apache/linux. Just a simple old hello world program, no big deal. In the 'K Develop' compiler in RedHat 9, I create a new terminal c project. It compiles and I can run it just fine in the terminal, but I cant run it as a CGI!!!!!!! I get an internal server error Grrr!!! Can you help?
CPP / C++ / C Code:
#include <stdio.h>

int main() {
printf("hello!\n");
return EXIT_SECCESS;
}
  #2  
Old 11-Oct-2003, 10:31
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
Sounds like more of a server config error than anything else. You've correct permissions set, and you've Apache set up to allow execution of C programs?

Remember also, that Apache won't be nice to your programs, and you'll have to supply the Content type header yourself:
Code:
printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10);

GF
  #3  
Old 12-Oct-2003, 19:25
DustinDavis DustinDavis is offline
New Member
 
Join Date: Oct 2003
Posts: 2
DustinDavis is an unknown quantity at this point
I finally figured it out, i needed to run

chmod a+x [FILE]

and once i did, it worked just fine. It seems my C programs dont work, but my perl scripts do and they also work when I compile the perl scripts. Thanks. I hope someone finds this, because there are so many sites that have the problem on there, but tell about the server config.

I had looked at the permissions of the file and they were all OK, had execution rights, etc etc. But once I did the chmod command, it worked fine.

Thanks.
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Birthdays: Popular 'Computer World' Personalities JdS Open Discussion Forum 6 12-Oct-2003 11:27
New-Window Links in a Standards-Compliant World jrobbio Web Design Forum 8 13-Aug-2003 07:38
FIFA World Cup 2002 Andrew Sports Forum 48 29-Jun-2002 05:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:14.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.