<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1465127346807_2202"><span>Hi all,</span></div><div id="yui_3_16_0_ym19_1_1465127346807_2202"><span><br></span></div><div id="yui_3_16_0_ym19_1_1465127346807_2202" dir="ltr"><span id="yui_3_16_0_ym19_1_1465127346807_2306">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:</span></div><div></div><div id="yui_3_16_0_ym19_1_1465127346807_2201"> </div><div class="signature" id="yui_3_16_0_ym19_1_1465127346807_2308"><div id="yui_3_16_0_ym19_1_1465127346807_2307"><div id="yui_3_16_0_ym19_1_1465127346807_2491"><div id="yui_3_16_0_ym19_1_1465127346807_2919"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2978" size="2">program HelloWeb;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2920"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2921"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2922"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3174">{$MODE OBJFPC}{$H+}{$J-}</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2923"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2924"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2925"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2">uses</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2926"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3035"> Classes, HTTPDefs, fpHTTP, fpCGI, fpWeb;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2927"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2928"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2929"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2">type</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2930"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_4251"> THelloModule = class(TFPWebModule)</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2931"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2982" size="2"> procedure HelloReq(Sender: TObject; ARequest: TRequest;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2932"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2981" size="2"> AResponse: TResponse; var Handled: Boolean);</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2933"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"> end;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2934"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2935"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2936"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2">var</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2937"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2983" size="2"> HelloModule: THelloModule;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2938"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2939"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2940"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2984" size="2">procedure THelloModule.HelloReq(Sender: TObject; ARequest: TRequest;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2941"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2985" size="2"> AResponse: TResponse; var Handled: Boolean);</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2942"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2">begin</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2943"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"> AResponse.ContentType := 'text/html;charset=utf-8';</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2944"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3187"> AResponse.Content := '<html><body>Hello World!</body></html>';</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2945"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"> Handled := true;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2946"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2">end;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2947"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2948"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2949"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3662">begin</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2950"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3018"> HelloModule := THelloModule.Create(nil);</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2951"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3663"> HelloModule.ActionVar := 'm';</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2952"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"> HelloModule.OnRequest := @HelloModule.HelloReq;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2953"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2954"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2955"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3033"> RegisterHTTPModule('THelloModule',THelloModule,true);</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2956"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2"><br id="yui_3_16_0_ym19_1_1465127346807_2957"></font></div><div id="yui_3_16_0_ym19_1_1465127346807_2958"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3005"> Application.Title := 'Hello World';</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2959"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3455"> Application.Initialize;</font></div><div id="yui_3_16_0_ym19_1_1465127346807_2960"><font face="Courier New, courier, monaco, monospace, sans-serif" size="2" id="yui_3_16_0_ym19_1_1465127346807_3363"> Application.Run;</font></div><div dir="ltr" id="yui_3_16_0_ym19_1_1465127346807_2961"><font face="Courier New, courier, monaco, monospace, sans-serif" id="yui_3_16_0_ym19_1_1465127346807_2980" size="2">end.</font></div></div></div><div id="yui_3_16_0_ym19_1_1465127346807_2307"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307" dir="ltr">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.</div><div id="yui_3_16_0_ym19_1_1465127346807_2307" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307" dir="ltr">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?</div><div id="yui_3_16_0_ym19_1_1465127346807_2307" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307" dir="ltr">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.</div><div id="yui_3_16_0_ym19_1_1465127346807_2307"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307">Any hints to solve the problem is really appreciated.</div><div id="yui_3_16_0_ym19_1_1465127346807_2307"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307">Thank you.</div><div id="yui_3_16_0_ym19_1_1465127346807_2307"><br></div><div id="yui_3_16_0_ym19_1_1465127346807_2307">Regards,</div><div id="yui_3_16_0_ym19_1_1465127346807_2307"><br></div>–Mr Bee<div id="yui_3_16_0_ym19_1_1465127346807_2418"><br></div></div></div></body></html>