This is a quick demonstration of creating your first CGI/FCGI Hello World application. You will need a HTTP Server with CGI/FCGI capabilities to run this application. For example: The Apache Server or The Litespeed Server
- Select from the menu: File - New Project
- Select your preferred Language on the left side
- Select “CGI (Common Gateway Interface)” as Project Type
- Enter a “mycgiapp” as Project Name
- Click on the “Create” button
LA.Developer will create your main project file and prepare the project to compile in CGI/FCGI mode.
6. Enter the following code at the “start conding here” comment
Basic Dialect: Response.setContent("Hello World") C++, JScript Dialect: Response.setContent("Hello World"); Pascal Dialect: Response.setContent(’Hello World’);
LA.Developer can’t run CGI/FCGI applications. To be able to test a CGI/FCGI project you need to compile and deploy the project to a HTTP Server with CGI/FCGI capabilities. Alternatively you can start coding your project as a SERVER application which LA.Developer can run, and then transfer your code to a CGI/FCGI project. The Response/Request/Session objects are identical for SERVER and CGI/FCGI projects. In this tutorial however, we assume that we will use a Apache Server to run our application.
To compile your project:
- Select from the menu: Project - Select Build Targets
- Check mark the Operating System you want to target. (In this tutorial we are targeting Linux 64)
- Click on the “OK” button
- Select from the menu: Project - Build Project
We have now compiled our mycgiapp executable and will copy it to the cgi-bin directory of our Apache Server. Please consult Apache Manuals about setting up the cgi-bin directory and cgi execution permission.
Now let’s run and test our mycgiapp application.
- Open your favorite Browser
- Enter http://localhost:8181/cgi-bin/mycgiapp (Note: the port number is the number you used to setup Apache Server)
As we can see, the CGI/FCGI application was executed by the server and your response was printed.