Autor Beitrag
Danny87
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Mo 21.05.07 14:42 
Hi Leute,

ich möchte ein C++ Script auf einer Website ausführen lassen.
Habe dazu die .cpp in den cgi-bin Ordner kopiert und mit dem Browser direkt versucht darauf zuzugreifen.
So in etwa: http://localhost/cgi-bin/cpptest.cpp

Allerdings bekomme ich dann immer eine Fehlermeldung. (Welche weiss ich ausm Kopf leider nicht mehr genau)

Die .cpp sieht so aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}


Wisst ihr was ich falsch mache und wie geht es richtig?

Vielen Dank schon mal! :)


Gruss
Daniel
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Mo 21.05.07 15:01 
C++ ist keine Scriptsprache, der Code muss also erst kompiliert werden, bevor er ausgeführt werden kann. Das Kompilat müsstest du dann wie angegeben ausführen können, wobei ich bei den cgi-Geschichten nicht sonderlich fit bin.

_________________
Bravery calls my name in the sound of the wind in the night...
Danny87 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Mo 21.05.07 15:12 
danke :)
ich probier das zu hause dann mal aus :)

gruss
daniel
Danny87 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Mo 21.05.07 18:19 
habs jetzt ausprobiert.
geht leider net.
ich bekomm nen error 500 mit der meldung:

Premature end of script-header: cpptest.exe

hat sonst noch jemand vorschläge?


gruss
daniel
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mo 21.05.07 18:28 
Evtl. auf ausführbar setzen (chmod +x). Ach ja, und es muss natürlich ein Server mit dem gleichen Betriebssystem sein, auf dem du das Programm compiliert hast. Und die meisten Webspace-Anbieter erlauben kein cgi von normalen Programmen.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Danny87 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Mo 21.05.07 18:31 
wie kann ich chmod ändern ohne ein ftp-programm?
hab bei meinem personal webserver leider kein ftp dabei (brauch ich ja auch eigentlich net ;) )
hab ne etwas ältere version vom minixampp
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mo 21.05.07 19:18 
user profile iconDanny87 hat folgendes geschrieben:
wie kann ich chmod ändern ohne ein ftp-programm?
hab bei meinem personal webserver leider kein ftp dabei (brauch ich ja auch eigentlich net ;) )
hab ne etwas ältere version vom minixampp

Über telnet oder (besser) ssh. Aber wie lädst du denn die Dateien ohne FTP hoch?
Oder läuft das ganze auf deinem eigenen Rechner? Dann ist dieser Schritt unnötig, es sei denn du führst Linux aus. (Und wenn du das tun würdest, wüsstest du, wie du chmod +x setzt.)

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Mi 23.05.07 23:45 
Dir fehlt der Response Header:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
#include <iostream>

int main()
{
    // Header
    std::cout << "Content-Type: text/plain\r\n\r\n";
    // Seiteninhalt
    std::cout << "Hello World!\r\n";
    return 0;
}


HTTP will \r\n, also nicht std::endl nehmen, das ist platform spezifisch.

_________________
Klein, schwarz und ärgert Techniker? Jumper!