我想在我的项目中实现BitBucket piplines,我的安装扩展mysqli有问题。我的配置是
image: php:7.1.1
pipelines:
default:
- step:
caches:
- composer
script:
- docker-php-ext-install mysqli pdo pdo_mysql
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- php vendor/bin/tester -p php --setup "tests/inc/setup.php" "tests/cases/"
services:
- mysql
definitions:
services:
mysql:
image: mysql
environment:
MYSQL_DATABASE: 'test'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'test'
MYSQL_PASSWORD: 'testpass'
所有步骤都已完成,但是当测试框架启动时,所有测试都会因错误而失败
错误:未找到类'mysqli'
我是否必须在php.ini中启用它?或者以其他方式安装它?
答案 0 :(得分:1)
我明白了。你必须添加mysql-client然后告诉它使用扩展名。这是为我工作的管道:
pipelines:
default:
- step:
name: php-56-mysql-latest
image: php:5.6-apache
script:
# install dependancies and mysql client
- apt-get update && apt-get install -y unzip mysql-client
# enable the mysqli extension
- docker-php-ext-install mysqli
# install composer
- 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
# fake sendmail so emails don't bomb
- ln -s /bin/true /usr/sbin/sendmail
# run your composer tests
- composer test
services:
- mysql
definitions:
services:
mysql:
image: mysql:latest
environment:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root