Hi all,
I'm now learning how to use fpWeb. But for some reasons, I don't want to use 
Lazarus. Instead, I want to write the program using plain text editor or 
console text editor (like vim, nano, etc), in case I need to do it remotely. 
It's now just a simple Hello World program, so it must be simple enough to 
write the program as a single file without Lazarus. However, I failed. There 
must be something stupid that I forgot to write but I don't know what that is. 
So here's my code: program HelloWeb;
{$MODE OBJFPC}{$H+}{$J-}
uses  Classes, HTTPDefs, fpHTTP, fpCGI, fpWeb;
type  THelloModule = class(TFPWebModule)    procedure HelloReq(Sender: TObject; 
ARequest: TRequest;                       AResponse: TResponse; var Handled: 
Boolean);  end;
var  HelloModule: THelloModule;
procedure THelloModule.HelloReq(Sender: TObject; ARequest: TRequest;            
                    AResponse: TResponse; var Handled: Boolean);begin  
AResponse.ContentType := 'text/html;charset=utf-8';  AResponse.Content := 
'<html><body>Hello World!</body></html>';  Handled := true;end;
begin  HelloModule := THelloModule.Create(nil);  HelloModule.ActionVar := 'm';  
HelloModule.OnRequest := @HelloModule.HelloReq;
  RegisterHTTPModule('THelloModule',THelloModule,true);
  Application.Title := 'Hello World';  Application.Initialize;  
Application.Run;end.
It was compiled fine without any errors using -XXs -CX -O3 parameters. But when 
the executable is deployed and then accessed from the browser, it returns 500 
internal server error. I don't know what to do as I saw nothing is wrong.
That's the first problem. The second one is a question. I'd like to use fpWeb 
components in plain procedural way, without using the TApplication 
infrastructure, especially for simple CGI apps/services. Is it possible? Any 
advices?
I'm using a Linux Ubuntu 14.04 machine with Apache web server. I believe the 
problem has nothing to do with the OS nor the web server because my plain 
Pascal CGI (without using fpWeb) is running just fine.
Any hints to solve the problem is really appreciated.
Thank you.
Regards,
–Mr Bee
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to