Howto include sqlite3 --with-dbd - Apache

This is a discussion on Howto include sqlite3 --with-dbd - Apache ; I'm struggling to find any info or examples on how to include sqlite3 support for mod_authn_dbd and httpd-2.2.4. This is my current configure line but it's not working. I suspect I need to build apr separately but it's not clear ...

+ Reply to Thread
Results 1 to 7 of 7

Howto include sqlite3 --with-dbd

  1. Default Howto include sqlite3 --with-dbd

    I'm struggling to find any info or examples on how to include
    sqlite3 support for mod_authn_dbd and httpd-2.2.4. This is my
    current configure line but it's not working. I suspect I need
    to build apr separately but it's not clear if I need to and/or
    how to. Can anyone suggest modifications to my ./configure ?

    ../configure --prefix=/usr --enable-layout=RedHat --datadir=/home/httpd \
    --enable-modules=all --enable-mods-shared=all --enable-ssl --enable-so \
    --enable-proxy --enable-proxy-connect --enable-proxy-ftp \
    --enable-proxy-http --enable-suexec --enable-dbd --with-sqlite3 \
    --enable-cache --enable-disk-cache --enable-mem-cache \
    --with-apr=/usr --with-apr-util=/usr

    --markc

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  2. Default Re: Howto include sqlite3 --with-dbd

    On Fri, 8 Jun 2007 03:54:55 +0000
    Mark Constable <markc@renta.net> wrote:

    > I'm struggling to find any info or examples on how to include
    > sqlite3 support for mod_authn_dbd and httpd-2.2.4. This is my
    > current configure line but it's not working. I suspect I need
    > to build apr separately


    Building apr and apr-util will fix it. You can do that from
    your httpd tarball by building srclib/apr and srclib/apr-util
    before building httpd itself.

    Your trouble is (probably) that you have an existing apr
    installation without sqlite3 support. If you get rid of that,
    and if sqlite3 is installed somewhere Apache can find it,
    it'll build by default.


    --
    Nick Kew

    Application Development with Apache - the Apache Modules Book
    http://www.apachetutor.org/

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  3. Default Re: Howto include sqlite3 --with-dbd

    On Friday 08 June 2007 07:11:17 Nick Kew wrote:
    > Building apr and apr-util will fix it. You can do that from
    > your httpd tarball by building srclib/apr and srclib/apr-util
    > before building httpd itself.


    Thanks Nick. It seems my ArchLinux desktop apr-util package uses
    --without-sqlite3 in it's PKGBUILD so I'll try enabling that next.

    > Your trouble is (probably) that you have an existing apr
    > installation without sqlite3 support. If you get rid of that,
    > and if sqlite3 is installed somewhere Apache can find it,
    > it'll build by default.


    As it turns out, the Debian4 stable libaprutil1 package does indeed
    include sqlite3 support...

    # /usr/src/apr-util-1.2.7+dfsg grep sqlite3 debian/rules
    ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE)
    --enable-layout=Debian --with-apr=/usr/bin/apr-1-config --with-ldap=yes
    --with-dbm=db43 --with-sqlite3 --with-pgsql=/usr --without-gdbm
    --without-sqlite2 --with-berkeley-db

    # ldd /usr/sbin/apache2 | grep apr
    libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0xb7f86000)
    libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0xb7d8d000)

    # strings /usr/lib/libaprutil-1.so.0 | grep sqlite3
    apr_dbd_sqlite3_driver
    sqlite3_mprintf
    sqlite3_free
    sqlite3_errmsg
    sqlite3_prepare
    sqlite3_column_count
    sqlite3_step
    sqlite3_column_bytes
    sqlite3_column_type
    sqlite3_column_text
    sqlite3_finalize
    sqlite3_column_name
    sqlite3_changes
    sqlite3_close
    sqlite3_open
    libsqlite3.so.0
    sqlite3

    However, after enabling mod_auth_basic and mod_authn_dbd in the
    Debian stable apache 2.2.3 configuration I am still getting...

    Invalid command 'DBDriver', perhaps misspelled or defined by
    a module not included in the server configuration failed!

    <Directory /var/www/secret/>
    DBDriver sqlite3
    DBDParams "/var/www/secret/.ht.sqlite"
    DBDMin 1
    DBDKeep 2
    DBDMax 5
    DBDExpTime 30
    AuthType Basic
    AuthName Test
    AuthBasicProvider dbd
    Require valid-user
    AuthDBDUserPWQuery "select pw from passwd where uid=%s"
    </Directory>

    I'd be grateful for any more suggestions.

    --markc

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  4. Default Re: Howto include sqlite3 --with-dbd

    On Fri, 8 Jun 2007 10:17:33 +0000
    Mark Constable <markc@renta.net> wrote:


    > Invalid command 'DBDriver', perhaps misspelled or defined by
    > a module not included in the server configuration failed!


    You need to load mod_dbd.

    --
    Nick Kew

    Application Development with Apache - the Apache Modules Book
    http://www.apachetutor.org/

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  5. Default Re: Howto include sqlite3 --with-dbd

    On 08/06/07, Mark Constable <markc@renta.net> wrote:
    > However, after enabling mod_auth_basic and mod_authn_dbd in the
    > Debian stable apache 2.2.3 configuration I am still getting...
    >
    > Invalid command 'DBDriver', perhaps misspelled or defined by
    > a module not included in the server configuration failed!


    Did you perhaps forget to load mod_dbd?

    --
    noodl

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  6. Default Re: Howto include sqlite3 --with-dbd

    On Friday 08 June 2007 11:42:08 Nick Kew wrote:
    > You need to load mod_dbd.


    Ah, of course, but... perhaps it's now a Debian problem.

    # a2enmod dbd
    Module dbd installed; run /etc/init.d/apache2 force-reload to enable.

    # /etc/init.d/apache2 force-reload
    Forcing reload of web server (apache2).../usr/sbin/apache2ctl:
    line 78: 31994 Segmentation fault $HTTPD -k $ARGV
    failed!

    DBDriver sqlite3
    DBDParams "/var/www/secret/.htserver"
    #DBDMin 1
    #DBDKeep 2
    #DBDMax 5
    #DBDExpTime 30

    <Directory /var/www/secret/>
    AuthType Basic
    AuthName Test
    AuthBasicProvider dbd
    Require valid-user
    AuthDBDUserPWQuery "select pw from passwd where uid=%s"
    </Directory>

    The end of a strace doesn't reveal much...

    # strace -f /usr/sbin/apache2
    ....
    connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0
    poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1
    writev(3, [{"\2\0\0\0\v\0\0\0\7\0\0\0", 12}, {"passwd\0", 7}], 2) = 19
    poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1
    recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"passwd\0", 7}], msg_controllen=16, {cmsg_len=16, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {4}}, msg_flags=0x80000000 /* MSG_??? */}, MSG_NOSIGNAL) = 7
    fstat64(4, {st_mode=S_IFREG|0600, st_size=217016, ...}) = 0
    pread64(4, "\1\0\0\0h\0\0\0\220f\0\0\1\0\0\0\367\333\25F\0\0\0\0\323"..., 104, 0) = 104
    mmap2(NULL, 217016, PROT_READ, MAP_SHARED, 4, 0) = 0xb70d6000
    close(4) = 0
    close(3) = 0
    socket(PF_FILE, SOCK_STREAM, 0) = 3
    fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
    fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
    connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0
    poll([{fd=3, events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1
    writev(3, [{"\2\0\0\0\f\0\0\0\6\0\0\0", 12}, {"group\0", 6}], 2) = 18
    poll([{fd=3, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1
    recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"group\0", 6}], msg_controllen=16, {cmsg_len=16, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {4}}, msg_flags=0x80000000 /* MSG_??? */}, MSG_NOSIGNAL) = 6
    fstat64(4, {st_mode=S_IFREG|0600, st_size=217016, ...}) = 0
    pread64(4, "\1\0\0\0h\0\0\0\226\6\0\0\1\0\0\0\367\333\25F\0\0\0\0\323"..., 104, 0) = 104
    mmap2(NULL, 217016, PROT_READ, MAP_SHARED, 4, 0) = 0xb70a1000
    close(4) = 0
    close(3) = 0
    stat64("/dev/urandom", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
    stat64("/dev/urandom", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
    --- SIGSEGV (Segmentation fault) @ 0 (0) ---
    +++ killed by SIGSEGV +++
    Process 3808 detached

    Is anyone out there successfully using sqlite3 via mod_dbd ?

    --markc

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



  7. Default Re: Howto include sqlite3 --with-dbd

    On Friday 08 June 2007 12:25:17 Mark Constable wrote:
    > Ah, of course, but... perhaps it's now a Debian problem.


    And on my ArchLinux desktop where I just compiled apr-util
    --with-sqlite3 the httpd daemon at least runs but shows an
    endless stream of the below in the logs. An authentication
    attempt fails even though I provide the right username and
    password (confirmed via a direct lookup to the sqlite3 db).

    Also, would it be possible that this...

    AuthDBDUserPWQuery "select pw from passwd where uid=%s"

    should have single quotes like... ?

    AuthDBDUserPWQuery "select pw from passwd where uid='%s'"


    *** glibc detected *** /usr/sbin/httpd: double free or corruption (!prev): 0x082e7080 ***
    ======= Backtrace: =========
    /lib/libc.so.6[0xb7c2c5e6]
    /lib/libc.so.6(__libc_free+0x89)[0xb7c2e2a9]
    /usr/lib/libapr-1.so.0(apr_allocator_destroy+0x2d)[0xb7d5801d]
    /usr/lib/libapr-1.so.0(apr_pool_destroy+0x195)[0xb7d58745]
    /usr/sbin/httpd[0x8085ad4]
    /usr/sbin/httpd[0x8085afd]
    [0xb7ee9420]
    /usr/sbin/httpd(unixd_accept+0x2c)[0x808762c]
    /usr/sbin/httpd[0x8085db1]
    /usr/sbin/httpd[0x80861e3]
    /usr/sbin/httpd[0x8086294]
    /usr/sbin/httpd(ap_mpm_run+0xc6d)[0x8086f1d]
    /usr/sbin/httpd(main+0x935)[0x8061fd5]
    /lib/libc.so.6(__libc_start_main+0xe0)[0xb7bdc970]
    /usr/sbin/httpd(apr_bucket_mmap_make+0x6d)[0x8061111]

    --markc

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org



+ Reply to Thread