apache基于mysql认证问题
在网上爬了两天了,还是没有找到这方面对我有很大作用的宝典。一般都是apache基于文本的认证方式,偶尔找到的也说得感觉不是很详细(也许我太笨,反正我没理解,更不用说装好了)。照搬官方的说明也没弄好,惨啊。
倒是在这里找到不少人遇到安装mod_auth_mysql出错的问题,但还是没解决。我一开始也遇到了,所幸还算有点运气,把mod_auth_mysql.c 改了改,居然让我装上去了。(我的环境:Apache/2.2.6 (Unix)+Mysql6.0.2-alpha 官方的说明里mysql好像只列到 Mysql 5.XXX的)
mod_auth_mysql信息
mod_auth_mysql.tgz 19-May-2007 21:10 19K GZIP compressed tar archiv
下载地址:http://modules.apache.org/search?id=416
可惜还是没有做好apache与mysql的认证。哪位前辈知道的麻烦指点一下。最好能照抄的,这两天看得我头疼,估计让我一个一个的敲都敲错,只好先抄一抄了。
一开始安装出错如下:
[root@mail mod_auth_mysql]# /usr/local/apache/bin/apxs -cia -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient mod_auth_mysql.c
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/mysql/include/mysql/ -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
mod_auth_mysql.c:111:25: mysql/mysql.h: No such file or directory
mod_auth_mysql.c:162: error: syntax error before '*' token
mod_auth_mysql.c:162: warning: data definition has no type or storage class
mod_auth_mysql.c: In function `open_db_handle':
mod_auth_mysql.c:372: error: syntax error before "mysql_conn"
mod_auth_mysql.c:389: error: `mysql_conn' undeclared (first use in this function)
mod_auth_mysql.c:389: error: (Each undeclared identifier is reported only once
mod_auth_mysql.c:389: error: for each function it appears in.)
mod_auth_mysql.c:443: warning: assignment makes pointer from integer without a cast
mod_auth_mysql.c: In function `is_virtual_in_db':
mod_auth_mysql.c:473: error: `MYSQL_RES' undeclared (first use in this function)
mod_auth_mysql.c:473: error: `result' undeclared (first use in this function)
mod_auth_mysql.c:508: error: `MYSQL_ROW' undeclared (first use in this function)
mod_auth_mysql.c:508: error: syntax error before "data"
mod_auth_mysql.c:509: error: `data' undeclared (first use in this function)
mod_auth_mysql.c: In function `get_db_pw':
mod_auth_mysql.c:540: error: `MYSQL_RES' undeclared (first use in this function)
mod_auth_mysql.c:540: error: `result' undeclared (first use in this function)
mod_auth_mysql.c:586: error: `MYSQL_ROW' undeclared (first use in this function)
mod_auth_mysql.c:586: error: syntax error before "data"
mod_auth_mysql.c:587: error: `data' undeclared (first use in this function)
mod_auth_mysql.c: In function `get_db_grp':
mod_auth_mysql.c:614: error: `MYSQL_RES' undeclared (first use in this function)
mod_auth_mysql.c:614: error: `result' undeclared (first use in this function)
mod_auth_mysql.c:615: error: `MYSQL_ROW' undeclared (first use in this function)
mod_auth_mysql.c:615: error: syntax error before "data"
mod_auth_mysql.c:672: error: `data' undeclared (first use in this function)
apxs:Error: Command failed with rc=65536
|
编辑mod_auth_mysql.c,大约111行。
把#include <mysql/mysql.h>改成如下应该就能解决问题了(/usr/local/mysql是我的mysql安装路径,不同的自己改)
#include </usr/local/mysql/include/mysql/mysql.h>
保存再重新安装就行了。
************************************************************************
[root@mail mod_auth_mysql]# /usr/local/apache/bin/apxs -cia -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient mod_auth_mysql.c
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/mysql/include/mysql -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_auth_mysql.la -L/usr/local/mysql/lib/mysql -lmysqlclient -rpath /usr/local/apache/modules -module -avoid-version mod_auth_mysql.lo
/usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' mod_auth_mysql.la /usr/local/apache/modules
/usr/local/apache/build/libtool --mode=install cp mod_auth_mysql.la /usr/local/apache/modules/
cp .libs/mod_auth_mysql.so /usr/local/apache/modules/mod_auth_mysql.so
cp .libs/mod_auth_mysql.lai /usr/local/apache/modules/mod_auth_mysql.la
cp .libs/mod_auth_mysql.a /usr/local/apache/modules/mod_auth_mysql.a
chmod 644 /usr/local/apache/modules/mod_auth_mysql.a
ranlib /usr/local/apache/modules/mod_auth_mysql.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/apache/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apache/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8.) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache/modules/mod_auth_mysql.so
[activating module `auth_mysql' in /usr/local/apache/conf/httpd.conf]
[root@mail mod_auth_mysql]#
********************************************************************
|