Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Laravel with PHP unit trying to connect to Microsoft SQL server

I am trying to run unit/integration tests via pipeline and using PHP unit. The DB server is Microsoft SQL.

Here's an excerpt of bitbucket-pipelines.yml

image: php:7.1.29

- step:
name: New Unit Tests
- composer
- mv "env/.env-unit" ".env"
# - php artisan migrate --seed
- mv -f "public/azure.web.config" "public/web.config"
- apt-get update && apt-get install -y unzip zip
- curl -sS | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- php artisan migrate --seed
# might need to wait for sqlserver to start properly here
# - sqlcmd -S localhost,1433 -U SA -P 'ThePassword' -i myhsm.sql
- vendor/bin/phpunit --bootstrap vendor/autoload.php
- zip -r .
- sqlserver
SA_PASSWORD: ThePassword


It will either error out if I tried the php artisan migrate or sqlcmd is not available in this image to import the DB data. Otherwise, in the sqlserver tab things look okay. I think it comes down to getting this script to be able to import the data. Otherwise there'll be lots of 

1) Tests\Unit\OrganisationControllerTest::testExample
Doctrine\DBAL\Driver\PDOException: could not find driver

 errors. Any suggestions on how to get MSSQL connected so my unit/integration tests can proceed?


1 answer

1 accepted

0 votes
Answer accepted

It looks like that the build image you use - php:7.1.29 - does not have the PDO Driver for MSSQL configured / enabled.

The official PHP docker images have pre-made routines to enable PHP extensions. You can first start with a shell script executing this in context of the pipeline and then port it into a Dockerfile for your own build container that ships with the expected configuration.


Please see the section How to install more PHP extensions which has this information.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,060 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you