Unable to create pipeline for Laravel 5.6 project

glazu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2018

Hey, I'm trying to create a pipeline for a Laravel 5.6 project, and I am failing miserably.

 

The issue I get is:

php artisan migrate
In Connection.php line 664:
could not find driver (SQL: select * from information_schema.tables where table_schema = Test and table_name = migrations)
In Connector.php line 67:
could not find driver

 

and my bitbucket-pipelines.yml is:

image: php:7-fpm
pipelines:
  default:
    - step:
        deployment: test
        script:
          - apt-get update && apt-get install -qy git curl libmcrypt-dev mysql-client zip unzip
          - docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql
          - ./install-composer.sh
          - composer install
          - export CACHE_DRIVER=redis
          - export SESSION_DRIVER=redis
          - export DB_CONNECTION=mysql
          - php artisan migrate
          - php artisan serve &
          - sleep 5
          - curl -vk http://localhost:8000
        services:
          - mysql

definitions:
  services:
    mysql:
      image: mysql
      environment:
        MYSQL_DATABASE: "Test"
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: "Test"
        MYSQL_PASSWORD: 'Test'

 

I do not know why this happens, this is my first time creating a pipeline. Any thoughts?

3 answers

0 votes
Andrew September 10, 2018
          - export DB_CONNECTION=mysql

should be 

          - export DB_CONNECTION=pdo_mysql
0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

Hi George,

Looking here (https://stackoverflow.com/questions/22463614/php-artisan-migrate-throwing-pdo-exception-could-not-find-driver-using-larav) it seems you may also need to install php-mysql into your container with apt (I'm not sure on how docker-php-ext-install interacts in this context)

Try adding

apt-get install php-mysql

to your script and see if that helps?

Thanks,

Phil

0 votes
glazu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2018

bump. anyone?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events