2016-06-18 50 views
7

我正在運行Travis CI來運行我的測試。我在使用php v5.6的Trusty容器。如何在Travis上啓用PHP redis擴展

這裏是我的整個.travis.yml文件:

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 

before_script:語法是直接從the travis documentation複製,但我建立失敗,一個作曲家錯誤說:

- The requested PHP extension ext-redis * is missing from your system. Install or enable PHP's redis extension. 

回答

0

看來,this documentation是不正確的!它不是before_script:它需要是before_install:。這似乎工作正常:

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

你知道一個教程,或者你能解釋你如何安裝redis與phpenv? – ChampS