Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[OT] c programme in apache
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
amdunlock
Guru
Guru


Joined: 24 Apr 2004
Posts: 409
Location: Darmstadt Germany

PostPosted: Wed Aug 11, 2004 3:29 pm    Post subject: [OT] c programme in apache Reply with quote

hi, kennt einer von euch ein gutes tutorial, in welchem beschrieben wird, wie man ein c programm in apache integriert ? also, dass die io strings des programms auf einer webseite auf einem apache ausgegeben werden ?

auf google finde ich naemlcih irgendwie nichts.

also vielen dank :D
_________________
-2500+ @ 3200+ ---- 512MB-Ram watercooled Htf X Triple @ 3 x 5V - Abit AN7 s*cking microguru - Geforce 6800 - Audigy 2 -=Gentoo Stage 2004.2 @ ext3=-
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Wed Aug 11, 2004 5:02 pm    Post subject: Reply with quote

soweit ich weiss musst du einfach nur das ding in ein cgi-bin verzeichnis packen (bzw. ein verzeichnis welches laut apache ausführungsrechte hat) und dann per Browser aufrufen.

Der Stdout geht dann auf die webseite.

Aber du musst den Text mit dem richtigen Content Type und 2 CR (\n) anfangen.
Back to top
View user's profile Send private message
pablo_supertux
Advocate
Advocate


Joined: 25 Jan 2004
Posts: 2961
Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)

PostPosted: Wed Aug 11, 2004 5:45 pm    Post subject: Reply with quote

meinst du selber ein apache modul erstellen wie mod_php? Oder was?
Sonst kannst du den cgi-bin Ordner benutzen.

Bsp:
Code:

#include<stdio.h>
int main(int argc, char** argv)
{
   int i=0;
   printf("Content-type: text/html\n\n");
   printf("<p>Hallo, <i>Pablo</i></p><br>\n");
   printf("Was ist argc? argc=%d\n", argc);
   for(i=0; i<argc; ++i)
   {
        printf("&nbsp;&nbsp;argv[%d]=%s<p>\n", i,argv[i]);
   }
   return 0;
}


Im cgi-bin Ordner musst du diese Datei mit gcc kompilieren. Dann rufst du
http://deinwebserver/cgi-bin/filename

Du kannst diese Datei live sehen aus:
http://supertux.homelinux.org:800/cgi-bin/hello
_________________
A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth!
Back to top
View user's profile Send private message
dalu
Guru
Guru


Joined: 20 Jan 2003
Posts: 535

PostPosted: Thu Aug 12, 2004 9:35 am    Post subject: Reply with quote

mit getenv("QUERY_STRING"); z.B. kannst du dann die aufrufzeile auslesen
noch ein beispiel

char temp[] = getenv("REMOTE_ADDR");
printf("%s",temp);

gibt deine ip aus, bzw die es aufrufenden
Back to top
View user's profile Send private message
pablo_supertux
Advocate
Advocate


Joined: 25 Jan 2004
Posts: 2961
Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)

PostPosted: Thu Aug 12, 2004 2:48 pm    Post subject: Reply with quote

dalu wrote:
mit getenv("QUERY_STRING"); z.B. kannst du dann die aufrufzeile auslesen
noch ein beispiel

char temp[] = getenv("REMOTE_ADDR");
printf("%s",temp);

gibt deine ip aus, bzw die es aufrufenden


getenv("QUERY_STRING"), das war nur ein Test für mich, den ich vor lange Zeit gemacht habe. Ich arbeite mit PHP lieber, dann kümmere ich mich nicht mehr darum.
_________________
A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth!
Back to top
View user's profile Send private message
lorschy
Apprentice
Apprentice


Joined: 16 Jul 2002
Posts: 191

PostPosted: Fri Aug 13, 2004 12:12 pm    Post subject: Reply with quote

falls du es dann hinbekommen hast, was nicht wirklich schwer is mit den hilfestellungen der anderen hier wuerde ich dir das hier raten.

Code:
*  dev-libs/cgicc
      Latest version available: 3.2.1
      Latest version installed: 3.2.1
      Size of downloaded files: 394 kB
      Homepage:    http://www.cgicc.org
      Description: A C++ class library for writing CGI applications
      License:     GPL-2


Ist imho ein guter anfang um cgi ueber/mit c/c++ zu betrieben.

ach btw. falls deine programme nicht wollen bzw abstuerzen machste einfach ein tail -f /var/log/apache2/error_log
und schau ob die benutzerrechte stimmen. deine cgi's muessen eingentlich nur 100 sind und dem apache user gehoeren.
Back to top
View user's profile Send private message
Realmaker
l33t
l33t


Joined: 17 Sep 2003
Posts: 683
Location: Bremen, Germany

PostPosted: Mon Oct 11, 2004 5:37 pm    Post subject: Reply with quote

Wie lese ich GET- und POST-Variablen aus?
_________________
Athlon 2600+ Barton, Asus A7N8x-X, nForce2, Asus Geforce FX5700 256mb, TwinMos 512ddr-sdram cl 2.5

Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum