Couldn't locate driver named mysql with PHPUnit and Bamboo OnDemand
Asked by Jean-Sebastien (GA):

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 !


Answers:
author: Jean-Sebastien (GA)
body: thank you Przemek :)

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

best regards,

J


author: FelipeA
body: 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


author: Jean-Sebastien (GA)
body: 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](/questions/308069/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 ?

comments: author: Przemek Bruski
body: The best option is to use an instance setup script.


author: Jean-Sebastien (GA)
body: 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


Tags: cloud