sometimes you need to change a php.ini setting on the fly in your gitlab-ci. this is quite easy.
simple run something like:
echo 'phar.readonly="0"' >> /etc/php/7.1/cli/conf.d/ci.ini
i used my debian stretch docker file, which uses the https://deb.sury.org/ repository for php. your directory structure may differ.
you can find out where php is loading its config files from by running:
php --ini
this prints a list similar to this:
$ php --ini
Configuration File (php.ini) Path: /etc/php/7.1/cli
Loaded Configuration File: /etc/php/7.1/cli/php.ini
Scan for additional .ini files in: /etc/php/7.1/cli/conf.d
Additional .ini files parsed: /etc/php/7.1/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.1/cli/conf.d/10-opcache.ini,
/etc/php/7.1/cli/conf.d/10-pdo.ini,
/etc/php/7.1/cli/conf.d/15-xml.ini,
/etc/php/7.1/cli/conf.d/20-apcu.ini,
/etc/php/7.1/cli/conf.d/20-apcu_bc.ini,
/etc/php/7.1/cli/conf.d/20-bcmath.ini,
/etc/php/7.1/cli/conf.d/20-bz2.ini,
/etc/php/7.1/cli/conf.d/20-calendar.ini,
/etc/php/7.1/cli/conf.d/20-ctype.ini,
...
in debian all files in the conf.d directory are included. so we only need to put it inside this directory. you can also append the config to the main file php.ini.
relevant part from the gitlab-ci.yml:
image: c33s/php:7.1
...
build:
stage: build
script:
- composer install
- php --ini
- echo 'phar.readonly="0"' >> /etc/php/7.1/cli/conf.d/ci.ini
- wget https://github.com/box-project/box2/releases/download/2.7.5/box-2.7.5.phar
- php box-2.7.5.phar build
- php satis.phar --version
...
- cover image by www_darkworkx_de https://pixabay.com/photos/devops-business-process-improvement-3155972/
Top comments (0)