How to include mysqli in bitbucket-pipelines.yml

First of all I am having trouble on fixing this error on the pipeline.

I am using Codeigniter as the framework, I was able to include the phpunit test, but now the problem is mysql.

This is the error that I am getting :

Type:  ErrorMessage:
Call to undefined function mysqli_init()
Filename: /opt/atlassian/pipelines/agent/build/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 136

Basically the question in place is, how to solve this issue and what is causing it?

1 answer

I figured it out. You have to add the mysql-client and then tell it to use the extension. This worked for me:

pipelines:
default:
- step:
name: php-56-mysql-latest
image: php:5.6-apache
script:
- apt-get update && apt-get install -y unzip mysql-client
- docker-php-ext-install mysqli
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer -V
- composer config -g github-oauth.github.com 9351b824c3e8f8fea61c0349f9b6aed8295878a8
- composer install --no-interaction --no-progress --prefer-dist
- ln -s /bin/true /usr/sbin/sendmail
- composer test
services:
- mysql

definitions:
services:
mysql:
image: mysql:latest
environment:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

638 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot