How to enable PHP redis extension on Travis
Asked Answered
S

1

12

I'm running Travis CI for running my tests. I'm using the Trusty container with php v5.6.

Here is my entire .travis.yml file:

language: php

dist: trusty

php:
  - '5.4'

before_script:
  - phpenv config-rm xdebug.ini
  - before_script: echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

sudo: required

install:
  - npm install -g gulp
  - composer install

env:
  - APP_ENV=circleci

script:
  - gulp test

The before_script: syntax is copied directly from the travis documentation but my builds fail with a composer error saying:

- The requested PHP extension ext-redis * is missing from your system. Install or enable PHP's redis extension.
Smirk answered 18/6, 2016 at 0:25 Comment(0)
S
7

It appears that this documentation is incorrect! Instead of before_script: it needs to be before_install:. This seems to work fine:

before_install:
  - phpenv config-rm xdebug.ini
  - before_script: echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
Smirk answered 18/6, 2016 at 21:32 Comment(2)
do you know a tutorial or could you please explain how you install redis with phpenv?Ramentum
I can confirm that this is workng in PHP7.2 Laravel 6.x Xenial distMorelock

© 2022 - 2024 — McMap. All rights reserved.