Couldn't locate driver named mysql with PHPUnit and Bamboo OnDemand

Hi,

I'm a new customer of Bamboo OnDemand, I want to use it to test/deploy PHP projects.

So I set up a PHPUnit 3.7 test task.

The testing obviously includes access to our mysql database, but the build fails as the mysql driver seems not being present in the Bamboo PHP environment. I got the error 'Couldn't locate driver named mysql' in the build log .

How can i fix this ?

thanks for any help !

4 answers

1 accepted

Accepted Answer
0 votes

thank you Przemek :)

Im going to investigate the Atlassian documentation about how to setup an instance script then.

best regards,

J

Hi Jean-Sébastien,

I'm assuming you're on a Linux environment.

Probably you don't have the php-mysql driver instaled, you can check that by running:

php --ri pdo

If you don't see mysql listed at PDO drivers, then that's the case.

To solve this:

If you're on a debian based distribution:

sudo apt-get install php5-mysql

If you're on a Red Hat based distribution:

yum -y install php-mysql

After that, check again the output of php --ri pdo command.

Best regards,

Felipe Alencastro

Hi Felipe, thank you for the follow-up of my question :)

I detect a slight misunderstanding here, let me clarify (sorry if I've not been clear enough :) ) :

The PHPUnit task I'm talking about is the one selected from the list of available Bamboo tasks, and, as I'm running Bamboo OnDemand, I guess this piece of software runs on some elastic agent from the Amazon cloud.

Therefore, the error I got ("no mysql driver") comes from here, apparently , not from our Linux servers where mysql and pdo driver do exist). If you see what I mean ?

So, from my understanding (but I'm quite a newbie in Bamboo world here ;) ) it's more like the Elasic Bamboo image was lacking this important driver, isn't it ? I'm surprised though. but then I wonder how to fix this

best regards, JS

Ok so, after reading some extra documentation, from what I understand now is that what I need here is to add the "MySQL" capabilities to my elastic agent.

And that could be done

either by creating a custom elastic image (but then you loose the Atlassian support, which is quite contradictory to the willing of having an OnDemand account which should buy you some confort and impediments instead...)

or you configure an EBS volume to add some script that would install MySQL on your instance (but it is not perfect solution since I need to checkout the whole repository for each build job, because I want a clean build, which it is not what EBS are really intended for. But It is problably the best workaround I found so far (still have to experiment it though).

hence the question : is there or will there be a Linux Elastic Image with the MySql capabilty, that allow us, for example, to run PHPUnit test against a MySql database ?

The best option is to use an instance setup script.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 2 hours ago in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

35 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you