LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-03-2004, 03:41 AM   #1
nickhx
Member
 
Registered: Jul 2004
Posts: 35

Rep: Reputation: 15
why my cgi program in c language can not run?


I have written a "hello"cgi program in c language, and successfully generate hello.cgi(gcc -o hello.cgi hello.c), and put this cgi file in the directory /var/www/html/cgi-bin, but why it can not run when i run on the http://hh/cigŁ_bin/hello.cig

my c program:
//
// File Name hello.c
//
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[],char *envp[] )
{
printf("Content-type: text/html\n\n");
printf("Hello___World");
}
 
Old 08-03-2004, 03:54 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
What do you mean it doesn't run? What exactly happens when you go that URL? Your domain name has some funky pound symbol in it that I can't resolve.

Try adding return 0; at end of your main() function.
 
Old 08-03-2004, 04:06 AM   #3
nickhx
Member
 
Registered: Jul 2004
Posts: 35

Original Poster
Rep: Reputation: 15
when i run on the http://hh/cig_bin/hello.cig, here hh is my local network ip ,10.0.1.34,the message is:

There was an unusual problem serving the requested URL '/cgi-bin/hello.cgi'.
 
Old 08-03-2004, 04:15 AM   #4
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
It must be a problem with your webserver configuration. I copied and pasted your code exactly and compiled it the exact same way you did and it works fine on my server.

Are you writing that URL in this forum or is that what you're actually trying to go to? Because the URL you're showing has hello.cig instead of hello.cgi.

Last edited by itsme86; 08-03-2004 at 04:17 AM.
 
Old 08-03-2004, 04:24 AM   #5
ljqu_happy
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
as you know, what configuration may be wrong?
 
Old 08-03-2004, 04:26 AM   #6
ljqu_happy
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
I'm sorry, it's my question
I post the first post using my firend's ID because that i cann't post a URL as a newer
 
Old 08-03-2004, 04:27 AM   #7
nickhx
Member
 
Registered: Jul 2004
Posts: 35

Original Poster
Rep: Reputation: 15
in fact ,this is ljqu_happy's question,he just use my ID to ask question^_^

Last edited by nickhx; 08-03-2004 at 04:36 AM.
 
Old 08-03-2004, 04:30 AM   #8
ljqu_happy
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
i'm sorry, cig in the first two posts is only a clerical error, i don't make this mistake in the address column.
 
Old 08-03-2004, 04:35 AM   #9
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Well, you'll want to look at your httpd.conf file (probably in the /etc/apache directory) and make sure you have all the CGI stuff set up correctly in there. If you make any modifications make sure you restart httpd so the changes will take effect.
 
Old 08-03-2004, 04:58 AM   #10
ljqu_happy
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
i have found the reason with one friend's help, the real reason is my hello.cgi is for INTEL architecture, but in fact my linux is ARM architecture.

Howerer, thank you very much!
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ CGI Program(Tell Me what you think) karlan Programming 0 03-29-2004 01:33 PM
How to run simple CGI program in browser ? amit_28oct Programming 5 03-23-2004 11:43 PM
Trying to run CGI - please help!! jacksmash Linux - Newbie 1 11-19-2003 11:28 PM
./picture.cgi won't run.... papageorgio02 Linux - Newbie 4 08-29-2003 07:31 AM
Program Language Sifvion Programming 7 06-06-2002 01:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration