DEV Community

Cover image for Add a php.ini setting for gitlab-ci

Posted on

Add a php.ini setting for gitlab-ci

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 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,

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
  stage: build
    - composer install
    - php --ini
    - echo 'phar.readonly="0"' >> /etc/php/7.1/cli/conf.d/ci.ini
    - wget
    - php box-2.7.5.phar build
    - php satis.phar --version

Top comments (0)