Submitted by Felix on 2007, November, 11:51 AM. The technology of Swine
This article is a comprehensive reference to several articles written in this, thanks to several authors, the following is the reference to a few of the original address:
http://blog.51766.com/page/zsc?entry=1141808884223
http://www.cublog.cn/u/1589/showart.php?id=239748
Http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg20921.html
Linux to solve the Apache does not support the Chinese name of the method is as follows:
Download related files and unzip
WebDAV Resources JP has the latest version of the Apache2 corresponding mod_encoding download
# wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
# wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
# tar ZXFV mod_encoding-20021209.tar.gz
# CP mod_encoding.c.apache2.20040616 MOD_ENCODING-20021209/MOD_ENCODING.C
Iconv_hook Compilation and Installation
You need to install Iconv_hook first before installing mod_encoding.
$ CD Mod_encoding-20021209/lib
$./configure
$ make
$ su
# make Install
After completing the above operation, the Iconv_hook related so file is placed under/usr/local/lib.
To enable the OS system to search for the so file, you need to complete a few lines
Open the/etc/ld.so.conf file and add a line to the path where Iconv_book is located, that is, "/usr/local/lib"
# vi/etc/ld.so.conf
/usr/local/lib
[ESC], [:], [w], [Q] Save exit.
# path= "$PATH:/sbin"
# Ldconfig
APXS Tool Installation
When compiling mod_encoding, you must have a APXS tool in Apxs,httpd-devel that includes creating and installing extension modules. If you have APACHE installed, check to see if there is a apxs in the ${apache_home}/bin/, if it exists, skip this step without installing the package yourself, and manually install the Httpd-devel if you have not already installed E.
# Apt-get Install Http-devel
Compilation of mod_encoding modules
Into the mod_encoding-20021209.tar.gz of the extract directory, that is mod_encoding-20021209
#./configure--with-apxs=/usr/sbin/apxs--with-iconv-hook=/usr/local/include
# make
When I execute the make command compile, I report the following error:
/usr/local/apache2/bin/apxs-c-i/usr/local/include-liconv_hook mod_encoding.c
/usr/local/apache2/build/libtool--silent--mode=compile Gcc-prefer-pic-dlinux=2-d_reentrant-d_gnu_source-d_ Largefile64_source-g-o2-pthread-i/usr/local/apache2/include-i/usr/local/apache2/include-i/usr/local/apache2/ Include-i/usr/local/include-c-o mod_encoding.lo mod_encoding.c && Touch Mod_encoding.slo
mod_encoding.c:in function ' get_client_encoding ':
Mod_encoding.c:174:warning:assignment makes pointer from integer without a cast
mod_encoding.c:181: ' regex_t ' undeclared (in the This function)
mod_encoding.c:181: (Each undeclared identifier are reported only once
Mod_encoding.c:181:for each function it appears in.)
Mod_encoding.c:181:parse error before ') ' token
Mod_encoding.c:at Top level:
Mod_encoding.c:187:parse error Before "return"
mod_encoding.c:in function ' set_server_encoding ':
Mod_encoding.c:213:warning:assignment makes pointer from integer without a cast
mod_encoding.c:in function ' add_client_encoding ':
mod_encoding.c:239: ' reg_extended ' undeclared (in the This function)
mod_encoding.c:239: ' Reg_icase ' undeclared (in the This function)
mod_encoding.c:239: ' Reg_nosub ' undeclared (in the This function)
Mod_encoding.c:244:warning:assignment makes pointer from integer without a cast
mod_encoding.c:in function ' default_client_encoding ':
Mod_encoding.c:270:warning:assignment makes pointer from integer without a cast
Mod_encoding.c:at Top level:
Mod_encoding.c:301:warning:initialization from incompatible pointer type
Mod_encoding.c:305:warning:initialization from incompatible pointer type
Mod_encoding.c:309:warning:initialization from incompatible pointer type
Mod_encoding.c:313:warning:initialization from incompatible pointer type
Mod_encoding.c:317:warning:initialization from incompatible pointer type
mod_encoding.c:in function ' Mod_enc_parse ':
Mod_encoding.c:499:warning:passing Arg 2 of ' ap_pbase64encode ' makes pointer from integer without a cast
Mod_encoding.c:501:warning:passing Arg 3 of ' apr_table_set ' makes pointer from integer without a cast
Apxs:Error:Command failed with rc=65536
.
Make: * * * [mod_encoding.so] Error 1
The reason is obvious, is not included in the regex.h, the solution is very simple, with VI open MOD_ENCODING.C,
Add the following line to the front of the #include #include <regex.h>
The compiler should be able to pass, but it's strange that there's a new error on my machine:
/usr/local/apache2/bin/apxs-c-i/usr/local/include-liconv_hook mod_encoding.c
/usr/local/apache2/build/libtool--silent--mode=compile Gcc-prefer-pic
-dlinux=2-d_reentrant-d_gnu_source-d_largefile64_source-g-o2
-pthread-i/usr/local/apache2/include-i/usr/local/apache2/include
-i/usr/local/apache2/include-i/usr/local/include-c-O Mod_encoding.lo
MOD_ENCODING.C && Touch Mod_encoding.slo
In the file included from Mod_encoding.c:17:
/usr/include/regex.h:362:parse error Before "size_t"
/usr/include/regex.h:369:parse error before ': ' token
/usr/include/regex.h:378:parse error before ': ' token
/usr/include/regex.h:382:parse error before ': ' token
/usr/include/regex.h:386:parse error before ': ' token
/usr/include/regex.h:390:parse error before ': ' token
/usr/include/regex.h:393:parse error before ': ' token
/usr/include/regex.h:396:parse error before ': ' token
/usr/include/regex.h:461:parse error Before "size_t"
/usr/include/regex.h:554:parse error Before "size_t"
/usr/include/regex.h:556:parse error Before "Regerror"
/usr/include/regex.h:557:parse error Before "size_t"
mod_encoding.c:in function ' get_client_encoding ':
Mod_encoding.c:175:warning:assignment makes pointer from integer without a cast
Mod_encoding.c:182:warning:passing Arg 1 of ' ap_regexec ' from incompatible pointer type
mod_encoding.c:in function ' set_server_encoding ':
Mod_encoding.c:214:warning:assignment makes pointer from integer without a cast
mod_encoding.c:in function ' add_client_encoding ':
Mod_encoding.c:245:warning:assignment makes pointer from integer without a cast
mod_encoding.c:in function ' default_client_encoding ':
Mod_encoding.c:271:warning:assignment makes pointer from integer without a cast
Mod_encoding.c:at Top level:
Mod_encoding.c:302:warning:initialization from incompatible pointer type
Mod_encoding.c:306:warning:initialization from incompatible pointer type
Mod_encoding.c:310:warning:initialization from incompatible pointer type
Mod_encoding.c:314:warning:initialization from incompatible pointer type
Mod_encoding.c:318:warning:initialization from incompatible pointer type
mod_encoding.c:in function ' Mod_enc_parse ':
Mod_encoding.c:500:warning:passing Arg 2 of ' ap_pbase64encode ' makes pointer from integer without a cast
Mod_encoding.c:502:warning:passing Arg 3 of ' apr_table_set ' makes pointer from integer without a cast
Apxs:Error:Command failed with rc=65536
.
Make: * * * [mod_encoding.so] Error 1
(This question I have not resolved, if resolved, I will update this paragraph)
#ls-L MOD_ENCODING.O
See if the MOD_ENCODING.O file has been generated and, if so, make succeeds in continuing the operation below.
# Gcc-shared-o mod_encoding.so Mod_encoding.o-wc,-wall-l/usr/local/lib-llib-liconv_hook
Generate mod_encoding.so file, copy the file to your module storage directory, generally ${apache_home}/modules/
# CP Mod_encoding.so/usr/local/apache/modules/mod_encoding.so
The setting of the HTTPD.CONFD
This is my setup file, reference to the Ytang's
LoadModule Headers_module modules/mod_headers.so
LoadModule Encoding_module modules/mod_encoding.so
<ifmodule mod_headers.c>
Header add Ms-author-via "DAV"
</IfModule>
<ifmodule mod_encoding.c>
Encodingengine on
Normalizeusername on
Setserverencoding GBK
Defaultclientencoding UTF-8 GBK GB2312
Addclientencoding "(Microsoft. * DAV $)" UTF-8 GBK GB2312
Addclientencoding "Microsoft. * DAV" UTF-8 GBK GB2312
Addclientencoding "microsoft-webdav*" UTF-8 GBK GB2312
</IfModule>
Transfer from an IT worker's technology portal--http://itworker.buylog.cn