Can't load driver file apr_dbd_mysql.so

Started by VaughanR, September 26, 2014, 07:20:44 AM

Previous topic - Next topic

VaughanR

I am having trouble getting httpd to start.  I am trying to use mysql and have the following mod_dbd configuration directives in my httpd.conf file:

# mod_dbd configuration
DBDriver mysql
DBDParams "host=localhost dbname=myDb user=myuser pass=somepass"
DBDMin          4
DBDKeep         8
DBDMax          20
DBDExptime      300

However, when I try to start httpd it comes up with a syntax error for the DBDriver line and an explanation:
"Can't load driver file apr_dbd_mysql.so"

I have installed httpd using this file httpd-2.4.10-x64-vc11.zip on a Windows 7 64bit system and I can see a file apr_dbd_mysql-1.dll in the ./bin directory.  I have Microsoft Visual C++ Redistributable (x64) Update 4 installed.

Has anyone managed to overcome this issue?

Gregg

try adding a copy of libmysql.dll into Apache's /bin folder.

VaughanR

I assume you mean the file libmysql.dll from the MySql Server 5.6/lib folder. If so, I did that but I still get the same error.  I would note that I did not install apache into C:\Apache24, would that cause a problem?

Gregg

It shouldn't but where did you install it to?

I'm upover and it's way past bedtime, I'll look into it tomorrow.

Gregg

#4
OK, here's the rub.

MySQL from 5.4 on does not export the my_init function which this connector calls. That means the connector will not compile with 5.4 and up. We compile it against 5.1.

I thought there was a bug report about this but I found nothing in bugzilla. It was sent in an email to dev@ and basically ignored.

Here's libmysql from 5.1.something-within-the-past-year that the connector was compiled with. I cannot guarantee however that it will connect to MySQL 5.4 and up. I guess you can try.

[Links removed, apr_dbd_mysql is now being built against MySQL 5.5]

I'll discuss this with one of the APR devs and see what we come up with. I'll probably have to create a bug report myself.

I've never locked anything in my config or user/passwords into a MySQL database so I've never been that concerned about it to be honest. The person that originally requested we build this connector has never said anything about it, I assume either it works for them or they still hang onto MySQL 5.1.


VaughanR

#5
Thanks for all your help with this Gregg.  I will try one of those libmysql's you listed.

I installed it in c:\Program Files\Apache2.4, but to make sure location wasn't a problem I also created a symbolic link from C:\Apache24 to that directory using mklink in a cmd window.

Interestingly I am trying to get a version of Apache2.4 running on windows to use for development.  I had Apache2.2 running in cygwin but when I upgraded the server to Centos7 it meant that it was running Apache2.4, so I needed to upgrade windows to that.  I was successfully using cygwin and Apache2.2 with MySql5.6, but cygwin does not have Apache2.4 (yet), neither does RedhatCygwin so I had to look for another alternative.  I note that cygwin was also using apr1.4.8 and apr-util1.5.3.  I have uninstalled apache and apr* from cygwin in case that was an issue.

VaughanR

Well, I can report that httpd now starts, but I will need to test whether it can access mysql5.6 successfully.

VaughanR

Hmm, I spoke too soon.  There are now no errors in parsing the httpd.conf file, but I am getting this error when I try and start it as a service:
The Apache2.4 service terminated with service-specific error Incorrect function..

Gregg

You will have to check the Event Log for that one

VaughanR


Gregg

I guess I'll just have to investigate with mysql 5.6. I suppose however I should find out what you are doing with this and how. I have no mysql and it starts as service with your above configuration example.

Gregg

It looks like this was fixed on mysql's side, I just compiled apr_dbd_mysql on VC9 against libmysql.dll version 5.6.21.
Now, with all the versions of mysql floating out there, which to choose to compile against, 5.1 or 5.6. Maybe I'll do the vc9 builds with 5.1 and the vc11 builds with 5.6.

I haven't had time to set up mysql and import a test database to test the connector for authentication yet. I'm still in the middle of reading since I am not versed in mysql.

VaughanR

Gregg, thanks again for all your help with this.
Yes, mysql starts as a service.

Gregg

Seeing as it's a connector and connects over tcp 3606 I do not understand why you're getting what you were getting.
I'll crank up my vc11 build system here in awhile and download mysql 5.6 x64 and build connectors against it. I still have some chores to finish first.

Gregg

#14
G'day

Edit: Old dead link that people still follow removed. There is no need now as the mysql conector is compiled with 5.6 now.

this is from APR-Util 1.5.4 so has a change from the one distributed with 2.4.10:

*) MySQL driver: Fix incorrect handling of bad parameter in the
    driver support for apr_dbd_transaction_end().  PR 56330.
    [Weiqiang Li <weiqiang_li hotmail.com>]

I hope it works for you.