[fpc-pascal] TCgiApplication in cgiapp unit - mostly deprecated

Graeme Geldenhuys graemeg.lists at gmail.com
Mon May 3 09:46:01 CEST 2010


duilio foschi het geskryf:
> how do I build a minimal 'hello world' CGI  application under Free Pascal ?

Can't get simpler than this:

---------------------
program cgitest;

{$mode objfpc}{$H+}

uses
  Classes;

begin
  writeln('Content-Type:text/html',#10#13);
  writeln('<html>');
  writeln('<head><title>FPC Test</title></head>');
  writeln('<body>Hello World</body>');
  writeln('</html>');
end.

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

Output is shown in the attached screenshot.  Obviously you need a webserver
to correctly view the results. Simply install Apache and enable CGI support
(if not enabled by default).

As you can see from the sample application, CGI apps are simply glorified
console applications.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcgi.png
Type: image/png
Size: 6533 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100503/9920a5cf/attachment.png>


More information about the fpc-pascal mailing list