httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Sterenborg" <>
Subject RE: [users@httpd] httpd-2.2.3 / MySQL 5.0.24a - buildsteps and improved error reporting
Date Wed, 20 Sep 2006 22:09:58 GMT
Ben <> wrote:
> vi  apr_dbd_mysql.c  #rewrite the functions dbd_mysql_error and
> dbd_mysql_check_conn as follows -
> /*---------------------------- apr_dbd_mysql.c
> ---------------------------------*/
> //Rewrite function dbd_mysql_check_conn (5 lines at line 744)
>        return "mysql error: VERSION_ERROR"; case CR_WRONG_HOST_INFO:
>      return "mysql error: WRONG_HOST_INFO"; case CR_WRONG_LICENSE:
>    return "mysql error: WRONG_LICENSE"; default: return "unspecified
> mysql error"; } } }
> /
> *-------------------------------------------------------------
> -------*/
> Make sure that the mysql file is now included in dbd -


I have setup a new testserver because I'm getting tired of not getting
this to work: it's a clean install without much installed.

I installed MySQL-5.0.24a from source into /usr/local, set it up (have
it running), modified /etc/ and ran ldconfig.
I downloaded httpd-2.2.3 and apr_dbd_myqsl.c again and applied your
proposed changes to all those files. I'm using the apr/apr-util that is
included with httpd-2.2.3.

I have to modify srclib/apr-util/dbd/apr_dbd_mysql.c because it just
doesn't include the mysql.h and errmsg.h files on line 48:

#include <mysql.h> 
#include <errmsg.h>
#elif defined(HAVE_MYSQL_MYSQL_H)
#include <mysql/mysql.h> 
#include <mysql/errmsg.h>
#include "/usr/local/include/mysql/mysql.h"
#include "/usr/local/include/mysql/errmsg.h"

As far as I can tell, HAVE_MYSQL_H or HAVE_MYSQL_MYSQL_H are never
defined but maybe I'm not looking in the right place (httpd source,
mysql.h, don't know what else)..

When doing "configure" for httpd, I get the following errors:

checking for Berkeley DB... found db4
checking for default DBM... sdbm (default)
  setting APRUTIL_EXPORT_LIBS to "-ldb-4.2"
  setting APRUTIL_LIBS to "-ldb-4.2"
/path/to/httpd-2.2.3/srclib/apr-util/configure: line 31266:
APU_CHECK_DBD: command not found
/path/to/httpd-2.2.3/srclib/apr-util/configure: line 31267:
APU_CHECK_DBD_MYSQL: command not found
/path/to/httpd-2.2.3/srclib/apr-util/configure: line 31268:
APU_CHECK_DBD_SQLITE3: command not found
/path/to/httpd-2.2.3/srclib/apr-util/configure: line 31269:
APU_CHECK_DBD_SQLITE2: command not found

srclib/apr-util/configure reads on line 31266:


I don't think that is correct.. If I'm not mistaken, this configure was
built when running srclib/apr-util/buildconf ?

Now, srclib/apr-util/include/apu.h reads on line 81:

#define APU_HAVE_PGSQL         @apu_have_pgsql@
#define APU_HAVE_MYSQL         @apu_have_mysql@
#define APU_HAVE_SQLITE3       @apu_have_sqlite3@
#define APU_HAVE_SQLITE2       @apu_have_sqlite2@

I didn't see this before. I modified these lines into:

#define APU_HAVE_PGSQL         0
#define APU_HAVE_MYSQL         1
#define APU_HAVE_SQLITE3       0
#define APU_HAVE_SQLITE2       0

When running make, I get these errors (sorry for the wrapping..):

/path/to/httpd-2.2.3/srclib/apr-util/.libs/ undefined
reference to `mysql_thread_end'
/path/to/httpd-2.2.3/srclib/apr-util/.libs/ undefined
reference to `mysql_stmt_init'
/path/to/httpd-2.2.3/srclib/apr-util/.libs/ undefined
reference to `mysql_stmt_fetch_column'
/path/to/httpd-2.2.3/srclib/apr-util/.libs/ undefined
reference to `mysql_stmt_execute'
collect2: ld returned 1 exit status
make[2]: *** [htdigest] Error 1
make[2]: Leaving directory `/path/to/httpd-2.2.3/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/path/to/httpd-2.2.3/support'
make: *** [all-recursive] Error 1

I modified srclib/apr-util/Makefile on line 13 to add:

INCLUDES = [...] -I/usr/local/include/mysql
APRUTIL_LDFLAGS = [...] -L/usr/local/lib/mysql
APRUTIL_LIBS = [...] -lmysqlclient_r

make clean && make

I *have* to make these changes to get it to work.
I get no errors anymore so I installed Apache.

Next I configured httpd.conf to test if DBD works.

DBDriver mysql
DBDPersist Off
DBDMin  1
DBDKeep 1
DBDMax 1
#DBDExptime 10
DBDParams "host=localhost dbname=apache user=root pass=<root_pass>"
LogLevel debug

<Directory />
      AuthType Basic
      AuthName "DBD authentication"
      AuthBasicProvider dbd
      Require valid-user
      AuthDBDUserPWQuery "SELECT pass FROM users WHERE user=%s"

I don't care I'm using root to access the database right now; this is
only a test setup, only used by myself and I want to make sure I'm able
to access the database.

apachectl restart

I browse to the page, get the logon dialog box and after I enter my
credentials it bails out with an error 500. error_log says this:

[Wed Sep 20 22:34:38 2006] [notice] SIGHUP received.  Attempting to
[Wed Sep 20 22:34:38 2006] [notice] Digest: generating secret for digest
authentication ...
[Wed Sep 20 22:34:38 2006] [notice] Digest: done
[Wed Sep 20 22:34:38 2006] [info] mod_unique_id: using ip addr
[Wed Sep 20 22:34:39 2006] [info] Init: Seeding PRNG with 136 bytes of
[Wed Sep 20 22:34:39 2006] [info] Init: Generating temporary RSA private
keys (512/1024 bits)
[Wed Sep 20 22:34:39 2006] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Wed Sep 20 22:34:39 2006] [info] Init: Initializing (virtual) servers
for SSL
[Wed Sep 20 22:34:39 2006] [info] Server: Apache/2.2.3, Interface:
mod_ssl/2.2.3, Library: OpenSSL/0.9.8c
[Wed Sep 20 22:34:39 2006] [notice] Apache/2.2.3 (Unix) mod_ssl/2.2.3
OpenSSL/0.9.8c DAV/2 configured -- resuming normal operations
[Wed Sep 20 22:34:39 2006] [info] Server built: Sep 20 2006 22:04:42
[Wed Sep 20 22:34:39 2006] [debug] prefork.c(991): AcceptMutex: sysvsem
(default: sysvsem)
[Wed Sep 20 22:35:16 2006] [crit] (20014)Internal error: DBD: Can't
connect to mysql. Null returned using parms: host=localhost
dbname=apache user=root pass=<root_pass>
[Wed Sep 20 22:35:16 2006] [error] [client] Error looking up
<me> in database

Well, time to check if root can access the database (that would be

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 28 to server version: 5.0.24a

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use apache
Database changed
mysql> select Id from users;
| Id |
|  1 | 
|  2 | 
|  3 | 
3 rows in set (0.00 sec)


I'm sure you got it to work because otherwise you surely wouldn't have
written these buildsteps, but I can't get DBD-MySQL to work and I really
don't know what I seem to be doing wrong here. ;-\


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message