Recent

Author Topic: I NEED HELP with fpweb components  (Read 15080 times)

garlar27

  • Hero Member
  • *****
  • Posts: 652
I NEED HELP with fpweb components
« on: September 23, 2010, 10:44:21 pm »
Hi,
   I'm trying to create an Apache 2.2 module, so I've looked at fpweb demos and I couldn't compile because I had the following error:

Quote
mod_helloworld.lpr(9,10) Fatal: Can't find unit fpapache used by mod_helloworld

Later I've read in some thread that copying fpweb source files to the example source it would work. I didn't wanted to do that so I added the source's path to the project and the above error didn't show up again ... but ... I had a new one:

Quote
/usr/share/fpcsrc/2.2.4/packages/fcl-web/src/fpapache.pp(143,40) Error: Identifier not found "ap_hook_handler_t"

And when I do Ctrl+Click at "ap_hook_handler_t" and the editor goes to "/usr/share/fpcsrc/2.2.4/packages/httpd20/src/http_config.inc" at line 1131 where is the following code:
Code: [Select]
type
  ap_HOOK_handler_t = function(r: Prequest_rec): Integer; cdecl; // Line 1131  ***
This file is included in "/usr/share/fpcsrc/2.2.4/packages/httpd20/src/httpd.pas" in line 84 as shown here:
Code: [Select]
{$include ap_provider.inc}
{$include util_cfgtree.inc}

{$include httpd.inc}
{$include http_config.inc} // line 84 ****
{$include http_core.inc}
{$include http_log.inc}
{$include http_main.inc}
{$include http_protocol.inc}
{$include http_request.inc}
{$include http_connection.inc}
{$include http_vhost.inc}

{$include util_script.inc}
{$include util_time.inc}
{$include util_md5.inc}
{$include ap_mpm.inc}

implementation
And "httpd.pas" is used by "fpapache.pp".

Changing permissions haven't done any difference.

Now I'm clueless and I need help.

Thanks in advance.

P.S.: By the way, I've been told that there is a lazwebextra.lpk located in /usr/lib/lazarus/0.9.28.2/components/fpweb/ but I couldn't find it... what I have installed is: weblaz.lpk.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I NEED HELP with fpweb components
« Reply #1 on: September 29, 2010, 11:32:10 pm »
   I have just noticed that my Apache version (2.2) and the one that used by Lazarus to compile ("/usr/share/fpcsrc/2.2.4/packages/httpd20/src/httpd.pas") are different :o.
   But I don't know why Lazarus assumes that it has to use "httpd20" instead of "httpd22". I couldn't find a define in the project  %).

   Does anybody knows how can I fix that?

bobo

  • Full Member
  • ***
  • Posts: 171
Re: I NEED HELP with fpweb components
« Reply #2 on: September 29, 2010, 11:58:37 pm »
You should just delete the HTTPD13 and HTTPD20 directories from your FPC units directory so the compiler will find the right compiled Apache version (2.2) .PPU files first.

Checking your fpc.cfg file(s) would not hurt either to make sure the paths are right and the proper FPC and units are used during compilations.

I would also strongly recommend compiling FPC 2.5.1 from SVN sources as well as Lazarus from the SVN trunk because there were a ton on improvements, fixes, new features implemented in the past year or so in fpweb/fcl-web. FPC 2.2.X is ancient.


garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I NEED HELP with fpweb components
« Reply #3 on: September 30, 2010, 04:21:24 pm »
Thank you Bobo!!

I will try this:
You should just delete the HTTPD13 and HTTPD20 directories from your FPC units directory so the compiler will find the right compiled Apache version (2.2) .PPU files first.

Checking your fpc.cfg file(s) would not hurt either to make sure the paths are right and the proper FPC and units are used during compilations.


   I know my FPC version it's old and weary as well as my Lazarus version, but I don't have pretty clear how to keep two FPC versions without conflicts, and also I haven't tried to do that because a shortage of time and guts  :-[.
   I expect the compiler to behave the same way all the time until a new stable version is released, than the probability of having different bugs from time to time.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: I NEED HELP with fpweb components
« Reply #4 on: September 30, 2010, 10:06:47 pm »
Let us know how did it go.

BTW, the Lazwebextra package is only for the latest SVN Lazarus (0.9.29/30) and latest SVN FPC (2.5.1), it is a new development. For now, fpweb and lazwebextra is separate because of the latter is still very new, I think it is planned to be merged together when the next Lazarus release happens.
If you need those new developments, you will have to get FPC and Lazarus from the SVN trunk and compile them yourself (not as a big deal as people might think).
I myself is doing this for both the Windows and Linux platforms, because the benefits are far outweigh the drawbacks. The releases are so far from each other for both FPC and Lazarus, that it is well worth doing this to have the latest fixes and developments.

And, because Lazarus is still in beta only, plus the releases are so far apart, the chances are that something will change for you between versions is not that low. So you don't loose much by using the SVN trunk source codes.
You do not need to recompile them every day, you can just check them out, compile them once, and maybe check them out every now and then after, or when a new fix is there for you.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I NEED HELP with fpweb components
« Reply #5 on: September 30, 2010, 10:45:23 pm »
I've been looking the fpc.cfg located in etc. and I found this:

Quote
# -----------------------
# Set Filenames and Paths
# -----------------------

# Slashes are also allowed under dos

# path to the messagefile, not necessary anymore but can be used to override
# the default language
#-Fr/usr/lib/fpc/$fpcversion/msg/errore.msg
#-Fr/usr/lib/fpc/$fpcversion/msg/errorn.msg

# searchpath for includefiles
#-Fi/pp/inc;/pp/rtl/inc

#IFDEF FPCAPACHE_1_3
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20
#ELSE
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22
#ENDIF
#ENDIF


Do you know where those FPCAPACHE_x_x are defined? I could erase what I don't need but I don't know why but I don't like to do that sort of things if I can avoid it.

I want to keep 2 Lazarus versions: the stable and the SVN trunk (for Lazarus and FPC). And I'm trying to figure out how to keep 'em working without conflicts.

I've been reading this post http://www.lazarus.freepascal.org/index.php/topic,8386.0.html and the wiki as well.

My fear is to break Lazarus and spend a day or two trying to get it back to life, I'm using Lazarus in my job, and we always have new requirements, bugs to fix and schedules to follow... thus ... never find the time.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: I NEED HELP with fpweb components
« Reply #6 on: September 30, 2010, 11:13:59 pm »
Those fpc.cfg lines are not a problem if you delete the two directories I mentioned.

Simply, your problem was that the compiler found the unit you use first in the search path that is for the wrong apache version, and have the same names. If  you delete the 1.3 and 2.0 apache unit diectories, the only one it can wind will be in the right Apache 2.2 directory.

Though, this is what I have in those lines in my fpc.cfg (I commented out the not used apache version lines in mine AND deleted those old apache version directories also):

Code: [Select]
#IFDEF FPCAPACHE_1_13
#-FuC:\pp\2.4.0/units/$FPCTARGET/httpd-1.3/
#ELSE
#IFDEF FPCAPACHE_2_0
#-FuC:\pp\2.4.0/units/$FPCTARGET/httpd-2.0
#ELSE
#-FuC:\pp\2.4.0/units/$FPCTARGET/httpd-2.2
-FuC:\pp\units/$FPCTARGET/httpd-2.2
#ENDIF
#ENDIF

# searchpath for units and other system dependent things
-FuC:\pp\units/$FPCTARGET/
-FuC:\pp\units/$FPCTARGET/*
-FuC:\pp\units/$FPCTARGET/rtl

# searchpath for libraries
#-FlC:\pp\2.4.0/lib
#-Fl/lib;/usr/lib

# searchpath for tools
#-FDC:\pp\2.4.0/bin/$FPCTARGET
-FDC:\pp\bin/$FPCTARGET

The funny thing is that these directories does not even exist in the FPC units, because they are HTTPD13 and HTTPD20, HTTPD22, and not HTTPD-2.2, etc. so you should fix at least the HTTPD22 one in the .cfg file.
« Last Edit: September 30, 2010, 11:17:46 pm by bobo »

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I NEED HELP with fpweb components
« Reply #7 on: October 01, 2010, 02:39:37 pm »
Those fpc.cfg lines are not a problem if you delete the two directories I mentioned.

Simply, your problem was that the compiler found the unit you use first in the search path that is for the wrong apache version, and have the same names. If  you delete the 1.3 and 2.0 apache unit directories, the only one it can wind will be in the right Apache 2.2 directory.


Got it!! It works!!
Thank you bobo!!


The funny thing is that these directories does not even exist in the FPC units, because they are HTTPD13 and HTTPD20, HTTPD22, and not HTTPD-2.2, etc. so you should fix at least the HTTPD22 one in the .cfg file.

It looks like a bug in FPC 2.4.


Another thing: I've noticed that some demos like echo.lpi are compiled as a program instead of a library, and throws an error when trying to execute:
Quote
An unhandled exception occurred at $080A3FF3 :
Exception : No REQUEST_METHOD passed from server.
  $080A3FF3
  $080A378F
  $0804853B  main,  line 9 of echo.lpr

I never had problem to compile them since they're not Apache modules. But I don't know how to use it. I didn't found instructions of how to use it.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: I NEED HELP with fpweb components
« Reply #8 on: October 01, 2010, 09:11:37 pm »
The echo demo is just the simplest CGI program, it is not an apache module.

You need to check weather the demo is an apache module or a CGI program, because only apache modules are libraries that you need to load with apache (conf) during apache startup.

For development I suggest using CGI or FCGI as you do not need to restart Apache after every change, and debugging is much easier too. If it is justified, after some testing you can just compile it as apache module and use it (lately I found that CGI and especially FCGI is better and easier to use than an Apache module). There are very few cases when an apache module show benefits over an FCGI app.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I NEED HELP with fpweb components
« Reply #9 on: October 04, 2010, 09:06:35 pm »
The echo demo is just the simplest CGI program, it is not an apache module.

You need to check weather the demo is an apache module or a CGI program, because only apache modules are libraries that you need to load with apache (conf) during apache startup.

Yeah, I realized that while I was previewing the post, and tried to change it to "How can I run it?" but at last I've change it wrongly  :-[ ... by the way ... How can I run the echo demo?  :D


... (lately I found that CGI and especially FCGI is better and easier to use than an Apache module). There are very few cases when an apache module show benefits over an FCGI app.

Can you tell me in which cases and why an Apache module is better than FCGI?

I'm new to network programming so I learns as I ... stumble with my ignorance ...  :-[

 

TinyPortal © 2005-2018