View previous topic :: View next topic |
Author |
Message |
Neb -
Joined: 21 Apr 2004 Posts: 28
|
Posted: Sat Apr 24, 2004 12:53 am Post subject: CGI |
|
|
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 |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat Apr 24, 2004 1:06 am Post subject: |
|
|
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 |
|
|
Guidance -
Joined: 04 May 2004 Posts: 7
|
Posted: Sat May 08, 2004 4:20 am Post subject: |
|
|
I want to try CGI executable written with C/C++, how should I setup that at Abyss? |
|
Back to top |
|
|
nquin321 -
Joined: 29 Jan 2004 Posts: 296 Location: Right Behind You
|
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun May 09, 2004 1:19 pm Post subject: |
|
|
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 |
|
|
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sun May 16, 2004 4:56 am Post subject: |
|
|
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 |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon May 17, 2004 2:35 pm Post subject: |
|
|
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 |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon May 17, 2004 8:42 pm Post subject: |
|
|
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 |
|
|
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Mon May 17, 2004 10:31 pm Post subject: |
|
|
Makes sense. It worked . Thanks!! |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Mon May 17, 2004 11:52 pm Post subject: |
|
|
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 |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue May 18, 2004 4:34 am Post subject: |
|
|
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 |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue May 18, 2004 5:35 am Post subject: |
|
|
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:
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:
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 |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue May 18, 2004 6:31 am Post subject: |
|
|
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 |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Wed May 19, 2004 1:19 am Post subject: |
|
|
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 |
|
|
|