OpenWrt Forum Archive

Topic: Compiling Apache with Module support (mod_rewrite and php)

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Howdy, I was able to compile apache from https://dev.openwrt.org/browser/packages/net/apache with a little help from forum2006.

The apache it produces runs fine and is very small. However, when I try to enable mod_so so apache can use loadable modules, the build fails and says

configure: error: mod_so has been requested but cannot be built on your system.

I tracked down the problem and from information on the net it seems that apache can't find or use dlopen(). I would like to know if OpenWRT has DSO capacity (since there are shared libraries I assume this is the case), and if anyone has any idea how to get apache to work with it.

Thanks in advance.

EDIT: I'm using Kamikaze 7.07 and the full buildroot.

(Last edited by TemplaraPhoenix on 31 Jul 2007, 11:16)

Okay, I fixed my problem.

The default OpenWRT apr (Apache Runtime Library) has DSO disabled (why? I guess to save space, but the difference in size in minimal). After enabling, apr and apache don't seem to get much bigger (difference is less than < 10KB).

Compiling all modules as dynamic is bad since apache says it has a 5% impact on performance. However, having it enabled allows for the omission of modules people might not need (I'm thinking SSL here) reducing space and for easy packaging and bolting on of other modules, such as PHP. If the performance impact is that great people can either compile themselves or if demand is great enough OpenWRT can offer two packages. I believe Debian has an apache-ssl package for precisely this reason. (statically linked SSL is significantly faster)

Changing these two lines in the Makefile for apr

--disable-dso \
 apr_cv_process_shared_works=no

by removing the first and changing the no to yes, allows you to set

--enable-so \
--enable-mods-shared='rewrite info foo' \

in apache's makefile.
I don't have a full grasp of the buildroot yet, so I'm sure there is some way to get the mod_rewrite.so and mod_info.so modules I compiled in the .ipkg itself, but I had to move them over manually after I compiled and updated to my custom packages.

Anyway... I was able to change my /etc/httpd.conf to load the modules without error and /server-info works! So I am happy that everything is working.

This really should be put in the documentation somewhere. If I figure out how to integrate better with the build system (i.e. get the modules in the .ipkg and integrate some defines with menuconfig) I'll post some patches. However, first I'll try to get PHP5 to integrate with apache as a module. This actually should be really easy now.

EDIT: I was wrong about apr and apache being bigger with DSO enabled. I left some .ipkgs on the flash when doing my comparison.

(Last edited by TemplaraPhoenix on 2 Aug 2007, 22:14)

I had real problems with this, first with apache configure saying that I needed apr-util 1.2.0 or later when I had 1.2.8, and then when I manually included the file by editing like 5884 in configure, I got other errors later on, about missing header files like apr_hooks.h and apr_buckets.h.  The hack I did to fix this was to copy all the header files from build_i386/apr-util-1.2.8/include/ to staging_dir_i386/usr/include/apr-1

It compiles now, but gives an error about a missing usr/include. But a package is made. Now, let's see if it will work nicely with php5 wink

The discussion might have continued from here.