Problems with modules for APACHE 2.4 lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- garlar27 · 2016-12-13 18:25 Hi, I've have an Apache module which works fine with Apache 2.2 but I need to use it in Apache 2.4. I couldn't find much info of what to do. After digging in the net and fiddling around the fpc.cfg and the code, I could make it work just by changing the uses clause in the project. Where said 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 uses ...., httpd, fpapacheI changed it to 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 uses ...., httpd24, fpapache24 Then finally Apache could load the module. But when a request reaches the server, it doesn't responded. Checking the Apache's error log I got the following message: 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 An unhandled exception occurred at $00007F3B31AFAA76:EHTTP: No REQUEST_METHOD passed from server.  $00007F3B31AFAA76 Does any body knows what is going wrong? Is there another thing I need to change in the project? ---- Lazarus 1.6.2 - FPC 3.0.0 - Server: CentOS Linux 64 bits - Apache 2.4.6 ---------------------------------------------------------------------- garlar27 · 2016-12-21 17:02 Well. Things got more complicated.... I have an old project (Apache module) which received a couple of files (client send it through POST method) and saves them to disk. Which worked good on Apache 2.2 (built with FPC 2.6.2). Then I had to rebuild it to use it with Apache 2.4 (I used FPC 3.0.0). But when a requirement was received this exception was raised (extracted from the file "/var/log/httpd/error_log") 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     An unhandled exception occurred at $00007F3B31AFAA76:    EHTTP: No REQUEST_METHOD passed from server.      $00007F3B31AFAA76 I added logs everywhere in the code to see where things went wrong. But the only logs I got where the ones executed when the module was loaded (the ones I put in the main block of the .lpr file). Then I was curious so I recompile the project but this time for Apache 2.2 to see what it logged. And it logged a looooot more, but the module was responding an error message, complaining about the fields being empty. So I recompiled the project with FPC 2.6.2 and every thing went back to normal the module was responding correctly again.  Then I went back again to the FPC 3.0.0 and added more logs to see what the fields really had (I know I'm a little paranoid ) and as the error message said all the fields where empty.... A code extract: 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    // ...(ARequest: TRequest; AResponse: TResponse)   //   SERVER SIDE: READING THE FIELDS...   AField1Value := trim(ARequest.QueryFields.Values['field1']);   if (Length(AField1Value ) = 0) then begin      AField1Value := trim(ARequest.ContentFields.Values['field1']);   end;   DLog('//   ###   ('+_PROC_NAME+') - AField1Value: '+ AField1Value);//***   -=[DELETE ME]=-   ***   ...  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    //   CLIENT SIDE SENDING FILES...   HTTP          := THTTPSend.Create;   APostData     := TStringList.Create;   ...   APostData.Clear;   APostData.Add('field1='  + EncodeUrl(Trim(memField1.Lines.Text))              +'&field2=' + EncodeUrl(Trim(memField2.Lines.Text))              );    HTTP.Clear;   APostData.SaveToStream(HTTP.Document);   HTTP.MimeType := 'application/x-www-form-urlencoded';    if not HTTP.HTTPMethod('POST', SomeURL) then begin      ...   end; In the meantime I got this answer on a question I posted in another thread which gives me more things to check: Quote from: Leledumbo on December 21, 2016, 10:17:06 amQuote from: garlar27 on December 19, 2016, 02:33:34 pmI've changed the units "httpd" to "httpd24" and "fpapache" to "fpapache24" now the apache server starts well. But when the request reaches the server it doesn't responds. Checking the apache "error_log" file I read that the error that occurred is Quote    An unhandled exception occurred at $00007FF8F0760C66:     EHTTP: No REQUEST_METHOD passed from server.       $00007FF8F0760C66Googling the message "No REQUEST_METHOD passed from server" points to FPC repositories only. For that reason I added temporary logs everywhere to pin point if there is something wrong with my code (which works fine on Apache 2.2) and the only logs I have are the ones in the "begin ... end." of the ".lpr" file. It makes me think that the exception is raised before my code has a chance to read the request. Something within apache virtual server config, I believe. I don't know how apache pass environment variables to its modules, but the core of fcl-web expects at least that environment variable to work. I will try to do a small example project to post it here. If I find something else I'll post it here. It might be use full for someone else. ---------------------------------------------------------------------- garlar27 · 2016-12-26 19:59 Well, this is a short example of a web module and a client to send requests. I have the same errors described in the previous posts and I suspect my problems come from a badly configured Apache server since the module does not receives ANY thing even though the "Request" event is fired. I tested this example on a Virtual Box running Ubuntu 16.4 with a fresh install of Apache 2.4.16 then I added the module mod_apache1.so with the appropriate permissions and test it with the tester app and with Firefox (GET method used) and had the same result. I didn't tested this example on Apache 2.2 yet, but I guess it would work fine. here is a brief explanation of the zip contents: What's in the zip: This example contains 2 projects:    1- the Apache module (needs WebLaz).    2- the tester app (needs synapse).   The Apache module was created using "Project/New Project" and picking "Apache Module" from the list. The tester app: I did my best to cover most of the things I needed and things I wanted to try in a request. There's space to add new features without messing the interface. WARNING there may be wrong captions in labels and group boxes. Portions of the code where never used/tested (though I believe it might work). NOTE:    I'm not a guru in HTTP neither in Apache installation and programming (-_-'). I'm learning in the process of trying to solve the problems... EDIT: READ-ME.txt might be incomplete I forgot to save the content. But the content is included in the lines above. ---------------------------------------------------------------------- mobilevil · 2017-08-07 10:06 hello, I am seeing the same issue but have only started working on it since yesterday. Did you make any progress? I suspect the FPC apache module interface is wrong, or we are using the wrong lib.