[SOLVED] CGI for ARM and command line compilation lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- aidv · 2016-01-17 02:31 Hello, it's been a while since I last was here to ask for help. I am trying to create a CGI project but I can't find proper tutorials for it. However, I've managed to create something that compiles fine. I am now trying to compile my CGI project on an ARMHF development board and it seems to compile, but i can't find where the compile CGI is located. I run the following command on my dev board: fpc unit1.pas all that happens is that two files are created, one called "unit1.ppu" and the other is called "unit1.o". Where is the compiled CGI? I need to develop CGI for an ARM based CPU with Debian on it. I am currently compiling from that board as well. ---------------------------------------------------------------------- Cyrax · 2016-01-17 03:05 You are compiling a unit. Create another source file named test.pas which contains these lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test;uses unit1; beginend. Modify it as needed, compile it and now you should have a executable binary. ---------------------------------------------------------------------- aidv · 2016-01-17 03:12 Quote from: Cyrax on January 17, 2016, 04:05:39 amYou are compiling a unit. Create another source file named test.pas which contains these lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test;uses unit1; beginend. Modify it as needed, compile it and now you should have a executable binary. You are an amazing person do you know that? ---------------------------------------------------------------------- aidv · 2016-01-17 03:30 I don't know if I should start a new thread, but I don't know if I'm using the CGI correctly. My CGI code looks like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  SysUtils, Classes, httpdefs, fpHTTP, fpWeb; type  TFPWebModule1 = class(TFPWebModule)    procedure DataModuleRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);   private    { private declarations }  public    { public declarations }  end; var  FPWebModule1: TFPWebModule1; implementation {$R *.lfm} procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest;  AResponse: TResponse; var Handled: Boolean);var  HexText, AsciiText: string;begin // HexText := ARequest.QueryFields.Values['hex']; // AsciiText := HexToAnsii(HexText);   AResponse.ContentType := 'text/html;charset=utf-8'; //EDIT: I un-commented this line  //AResponse.Contents.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'mainpage.html');  //AResponse.Contents.Text := Format(AResponse.Contents.Text, [HexText, AsciiText]);   AResponse.Contents.Text := 'Hello world!';  Handled := True;end; initialization  RegisterHTTPModule('TFPWebModule1', TFPWebModule1);end.   When I call a GET on it, I get a large string of text which seems to contain the actual binary data of the CGI. I do not receive the string "Hello world!" as expected. I call a GET command with the path "/cgi-bin/test" which is the correct path. Should I call a POST action instead or what have I missed? EDIT: I uncommented a specific line (please see the code again) but this time the binary data is not returned, instead NOTHING is returned. I have also tried to call "/cgi-bin/test.cgi" instead of "/cgi- bin/test". Nothing is returned. ---------------------------------------------------------------------- aidv · 2016-01-17 04:49 I found an solution on the internet. Visit this: http://leonardorame.blogspot.se/2010/02/web-20-programming-with- object-pascal.html ---------------------------------------------------------------------- Leledumbo · 2016-01-17 17:38 Read my tutorial. But obviously you need tutorial about HTTP and CGI (and how it can be used in conjunction with web server, which also requires its own reading after choosing an implementation, be it Apache, Nginx, lighttpd, etc.) first, find them somewhere else. ---------------------------------------------------------------------- aidv · 2016-01-17 22:21 Quote from: Leledumbo on January 17, 2016, 06:38:28 pmRead my tutorial. But obviously you need tutorial about HTTP and CGI (and how it can be used in conjunction with web server, which also requires its own reading after choosing an implementation, be it Apache, Nginx, lighttpd, etc.) first, find them somewhere else. Thanks for that tutorial. I will read it.