The Apache Haus Forum

Forum Topics => Apache 2.4 => Topic started by: VaughanR on September 26, 2014, 07:20:44 AM

Title: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 26, 2014, 07:20:44 AM
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?
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 26, 2014, 07:58:31 AM
try adding a copy of libmysql.dll into Apache's /bin folder.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 26, 2014, 09:32:56 AM
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?
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 26, 2014, 11:50:55 AM
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.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 26, 2014, 09:01:49 PM
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 [email protected] 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.

Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 27, 2014, 12:30:36 AM
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.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 27, 2014, 12:37:45 AM
Well, I can report that httpd now starts, but I will need to test whether it can access mysql5.6 successfully.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 27, 2014, 12:42:59 AM
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..
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 27, 2014, 04:41:31 AM
You will have to check the Event Log for that one
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 27, 2014, 10:00:27 AM
That was the error from the event log.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 27, 2014, 07:30:26 PM
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.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 27, 2014, 10:17:12 PM
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.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 29, 2014, 12:56:00 AM
Gregg, thanks again for all your help with this.
Yes, mysql starts as a service.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 29, 2014, 03:23:07 AM
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.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 30, 2014, 01:54:17 AM
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.

Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 30, 2014, 06:48:51 AM
Gregg,  I am happy to report that I have used your new version and I now get this message in the event log:
"The CYGWIN Apache2 web server service entered the running state."
I will test to see if it works with mysql5.6 when I get a chance.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 30, 2014, 06:55:31 AM
Gregg,  I can report that it successfully did three select statements from a mysql5.6 database, so it is looking good.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: VaughanR on September 30, 2014, 07:33:30 AM
Gregg, Sorry, I got myself confused, that was Cygwin Apache 2.2, not Windows Apache 2.4.

I install the service and the event log is:
A service was installed in the system.

Service Name:  Apache2.4
Service File Name:  "C:\Apache24\bin\httpd.exe" -k runservice
Service Type:  user mode service
Service Start Type:  auto start
Service Account:  LocalSystem

But when I try to start it I am still getting the same error:
"The Apache2.4 service terminated with service-specific error Incorrect function.."

Don't worry about this anymore.  This is taking way too much of my time and so I think I will do my development on my macbook as I have already managed to get httpd-2.4.10 installed and running on that platform.
Title: Re: Can't load driver file apr_dbd_mysql.so
Post by: Gregg on September 30, 2014, 08:55:30 AM
I hear you and I'm glad you have an alternative. The problem with this:
"The Apache2.4 service terminated with service-specific error Incorrect function.."

Is that it tells both you and I nothing other than the service did not start and there is some incorrect function. There are few hundred functions, which one is the question.

When I was playing around with it today I got libmysql to crash hard! What I got in the Event Log was still of little use but a bit more telling:
Faulting application httpd.exe, version 2.4.10.0, time stamp 0x53c5f5c5, faulting module libmysql.dll, version 5.6.21.0, time stamp 0x5411ad16, exception code 0xc0000005, fault offset 0x00031d28, process id 0x17dc, application start time 0x01cfdc3818f92470.