ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxÏÂÔö¼ÓApacheµÄrewrite Module

·¢²¼Ê±¼ä:2006-10-10 00:01:19À´Ô´:ºìÁª×÷Õß:coolbg
¹«Ë¾Ò»Ì¨Linux·þÎñÆ÷,ApacheĬÈÏ°²×°Ê±ºòûÓмÓÔØÈκÎModules,×î½üÒªÓõ½ApacheµÄrewriteÄ£¿é,¾­¹ýÒ»Ò¹Ò»ÌìµÄŬÁ¦,ÖÕÓڳɹ¦ÁË,ÐË·Ü....
ÏÖÔÚÁÐϼ¸¸öÒªµã:
1. Apache°²×°rewriteÄ£¿éµÄʱºòÐèÒªDBMÖ§³Ö£¬·ñÔòÎÞ·¨±àÒ룬ËùÒÔÊ×ÏÈÒª°²×°Ò»¸öGDBM ÏÂÔصØÖ·:ftp://ftp.gnu.org/gnu/gdbm/
°²×°²½Öè: ½øÈ밲װĿ¼,./configure; make; make install; make install-compat; ·ñÔòÎÞ·¨±àÒë³öndbm.hÍ·Îļþ.
2. È»ºóÓÃApache binĿ¼ÏµÄapxsÃüÁî°²×°
[code] /var/apache/bin/apxs -c mod_rewrite.c {
gcc -DLINUX=22 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE -I/var/apache/include -c mod_rewrite.c
gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
}
/var/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.so[/code]

È»ºóÔÚhttp.confÅäÖÃÎļþÀï¼ÓÉÏ£ºLoadModule rewrite_module libexec/mod_rewrite.so
½ÓÏÂÀ´ÓÃ/usr/local/apache/bin/apachectl
stopÍ£Ö¹apache£¬È»ºóÓÃÔÙstart£¬Ç§Íò×¢Ò⣬ÔÚÕâÀï²»ÄÜÓÃrestart»òÕßgraceful²ÎÊýÀ´ÖØÐÂÆô¶¯apache£¬±ØÐëÏÈÍ£Ö¹£¬È»ºóÔÙ¿ªÊ¼£¬»òÕßÊÇreboot»úÆ÷£¬·ñÔòrewrite½«²»Æð×÷Óá£

-------------------------------------------------------------------------------------------------------------
I tried to include in my Apache Web server's configuration the mod_rewrite module, but when I restarted the server, I received an error:

Cannot load /usr/local/apache/libexec/mod_rewrite.so into server:
/usr/local/apache/libexec/mod_rewrite.so: undefined symbol: dbm_fetch
The problem, as it turns out, is that mod_rewrite.so is compiled incorrectly. It should be linked with a dbm library but it isn't.

If you have an up-to-date set of Apache source files, you can easily solve this problem by manually rerunning the last compilation step of this module, using the correct options. When you execute make mod_rewrite.so in the appropriate directory, it performs this final step:

gcc -shared -o mod_rewrite.so mod_rewrite.lo
Rerun gcc, this time adding a reference to the GNU gdbm library:

gcc -shared -o mod_rewrite.so mod_rewrite.lo -lgdbm
Next, copy the newly created mod_rewrite.so over to /usr/local/apache/libexec or wherever your Apache module files are located.

In my case, this was all that was needed to solve the problem. Your mileage may vary.
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. wanghua131 ÓÚ 2006-10-12 09:07:24·¢±í:

    ±È½ÏºÃ ¶¥¡­¡­