CGI

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
Neb
-


Joined: 21 Apr 2004
Posts: 28

PostPosted: Sat Apr 24, 2004 12:53 am    Post subject: CGI Reply with quote

I'm good with HTML but really want to learn CGI. How to install, write, etc.. And I have, seriously no knowledge of it. If anyone can help with a tutorial, link, etc.. that is really easy to grasp for newbie's like myself.

Thanks
Back to top View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sat Apr 24, 2004 1:06 am    Post subject: Reply with quote

Well when you say "learn CGI," you are really saying a variety of things.

CGI is simply the output of HTML based on an interpreter resolving a dynamic script (in Abyss' case).
When most people say CGI, they are usually referring to Perl. However, now days, there are a variety of languages you can learn that basically accomplish the same thing.

Perl: What you are probably referring to. It is a lot harder than some other languages.
PHP: The majority of users here on this forum prefer PHP. It is probably the easiest to learn.
(Those are two common ones. There is also, ASP, JSP, ColdFusion, and a slew of other ones; but those are two to start out with),

For Perl, go here, and for PHP, go here.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Guidance
-


Joined: 04 May 2004
Posts: 7

PostPosted: Sat May 08, 2004 4:20 am    Post subject: Reply with quote

I want to try CGI executable written with C/C++, how should I setup that at Abyss?
Back to top View user's profile Send private message
nquin321
-


Joined: 29 Jan 2004
Posts: 296
Location: Right Behind You

PostPosted: Sat May 08, 2004 6:05 am    Post subject: Reply with quote

For a precompiled c program alll you have to do is put it in the cgi-bin and run it.
_________________
How many forum members does it takes to change a light bulb?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun May 09, 2004 1:19 pm    Post subject: Reply with quote

Guidance wrote:
I want to try CGI executable written with C/C++, how should I setup that at Abyss?

Very easy to do. Compile you C/C++ program, and put the resulting .exe file anywhere in your web space. For maximum security, add the virtual path of this .exe file (such as /mydata/mydata2/test.exe if you can access your file using http://yoursite/mydata/mydata2/test.exe) in your CGI Paths.
If you have many .exe files in a given directory, you can add something like /mydata/mydata2/*.exe in the CGI Paths to execute as a CGI application all the .exe files in /mydata/mydata2/ .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Sun May 16, 2004 4:56 am    Post subject: Reply with quote

I have copied and pasted a precompiled c++ program that came with Borland C++ Builder-X to my cgi-bin. I have added "/cgi-bin/*.exe" to my cgi paths. When loaded the server returns error 500. What else do i need to do? What have i done wrong? The file named Welcome.exe executes when i click it and returns Hello World.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon May 17, 2004 2:35 pm    Post subject: Reply with quote

eznetlinks,

If the EXE file you have only print "Hello World", it isn't conforming to the CGI specification and the server will generate Error 500.

A CGI executable should at least output the following two lines before the page body:
Code:

Content-Type: text/html


The second line is an empty line.

A simple CGI script in C/C++ is:

Code:

#include <stdio.h>

int
main()
{
     /* Minimum CGI headers */
     printf("Content-type: text/html\n\n");
     
     /* Body */
     printf("<HTML><BODY>Hello World</BODY></HTML>");
     
     return 0;
}

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Mon May 17, 2004 8:42 pm    Post subject: Reply with quote

I have also been messing with C++ but
my question is that every time I try and
compile a hello.c on Windows , it has an
error and can't open the file so whats

stdio.h ?

-------------------------------------------------------------------------------------

I also want to try this out for testing pruposes , how
can I create a hello world .exe program for the web ?
Back to top View user's profile Send private message Visit poster's website
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Mon May 17, 2004 10:31 pm    Post subject: Reply with quote

Makes sense. It worked . Thanks!!
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Mon May 17, 2004 11:52 pm    Post subject: Reply with quote

TRUSTpunk wrote:
I have also been messing with C++ but
my question is that every time I try and
compile a hello.c on Windows , it has an
error and can't open the file so whats

stdio.h ?

-------------------------------------------------------------------------------------

I also want to try this out for testing pruposes , how
can I create a hello world .exe program for the web ?

"stdio.h" is called a "header file" standing for "standard input and output." You can include different header files which result in different availability of variables.

For instance, when including studio.h, the method of printing some text is "printf," while when including iostream.h, the method of printing some text is "cout."

The code Aprelium gave you is fine for a hello world program that executes on the web. If you would like to write your own C/C++, you'll need a compiler to change the code into binary. Try this compiler to make an executable.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Tue May 18, 2004 4:34 am    Post subject: Reply with quote

I tried it and thats the one im using
now , can you write this up for me both
the stdio.h file and the hello world.

Nothing will compile it , I need
the header file and I don't know
how to create such a file , help!
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Tue May 18, 2004 5:35 am    Post subject: Reply with quote

Ok. DMC has alll the header files included, so it won't be a problem.

First, make a file called "hello.cpp" and put it in the \DM\bin directory. Then, open it up, and enter this code:
Code:
#include <stdio.h>

int main ()
{
  printf ("Hello World!");
  return 0;
}

Then, at the command line, cd all the way into the \DM\bin directory. Type this into the command line:
Quote:
dmc hello.cpp

You have just (presumably) compiled your first C++ program. Now, in the same command line window you compiled the program in, run the exe that was created by typing:
Quote:
hello

This should output "Hello World!"

Note: On some compilers now days, such as GCC (G++) it is not necessary to put the ".h" on header files--instead, just putting <iostream> or <stdio>. For safety reasons, and because I don't know how old these compilers are, I just included the .h to be sure. After all, it's only 2 characters long...
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Tue May 18, 2004 6:31 am    Post subject: Reply with quote

It works ! I can't believe it , I guess dos didn't allow it
the first time because I was using the set path

Code:

set path=c:\dm\bin
dmc hello
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Wed May 19, 2004 1:19 am    Post subject: Reply with quote

DM is actually very nice, because it doesn't have an installer. You can put it wherever you want. When you compile a program, and the .cpp isn't in the \bin directory, try putting "DMC C:\myfolder\file.cpp" and see if it works. That could also save you some organization.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
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


Powered by phpBB phpBB Group