continuous integration - How to enable PHP redis extension on Travis

586

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

Thebefore_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.
621

Answer

Solution:

It appears that this documentation is incorrect! Instead ofbefore_script: it needs to bebefore_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

People are also looking for solutions to the problem: mysql - Call to a member function query() on null - PHP

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.