Today, most dynamic web contents are generated by Perl scripts, PHP scripts, Java Servlets, Python, Ruby and so on. But I still love Apache Modules, developed using APR(Apache Portable Runtime), because in most cases it works much more faster than others.
OpenSolaris 2008.11 made it much more easier for us to install packages. It took only few seconds to install Apache2.2 and APR 1.3 packages in my machine, which I want to use it as a HTTP server.
Apache 2.2 started it's service with no problems. All I need to do was to open "Service Manager" from the menu bar, and add a check mark on the checkbox written "Apache 2.2 Server". It was very easy.
But something is wrong with APR. On my "Package Manager" it says that the installation is complete, but I still can't compile my original Apache module. I am sure this is not my fault, because even the template generated by apxs can't be compiled.
The following steps are the method to develop a new Apache Module named mod_saitama.
- % apxs -n saitama -g # Generates root directory, Makefile, modules.mk, mod_saitama.c (template source code of the Apache Module), .deps
- % apxs -i -a -c mod_saitama.c # Compile
- Add this module's information to the Apache configure file
- Open a file located in /etc/apache2/2.2/conf.d/modules-32.load
- Add a new line "LoadModule saitama libexec/mod_saitama.so" and close
- Create new file named saitama.conf files to location /etc/apache2/2.2/conf.d/saitama.conf
- Write "<Location "/saitama/">SetHandler saitama</Location>" and close
- Restart Apache daemon.
- Take a look at http://localhost/saitama/
- If the module is installed properly, a new site with "The sample page from mod_saitama.c" should be shown.
Actually, the installation stops at step 2. If I try, the compiler dumps an error log shown below.
env: No such file or directory
apxs:Error: Command failed with rc=65536
It is impossible for me to figure out the reason... Someone please help me!!
For the apxs compile to work you'll need gcc (or c) and make in your PATH. I had the same error compiling mod_expires until I changed that.
I hope this helps.
Posted by Ken on 10月月 08日, 2009年 at 11:20 午後 JST #