I have a Symfony-application which is dependent on APCu ( php5-apcu
). The server is running PHP 5.6 on Ubuntu 15.04. APCu is required as a dependency through composer, ie:
"require": {
"ext-apc": "~4.0"
}
Which works great. Trying to get the application running on Travis-CI, isn't as smooth, since they run Ubuntu 12.04, which doesn't have the php5-apcu
package, which yields:
E: Unable to locate package php5-apcu
Installing php-apc
doesn't satisfy the ext-apcu
requirement, and I'd prefer not to promote deprecated packages.
Any suggestions on how to setup APCu on Travis CI? Preferably without manually downloading the package.
You can easily install the apcu extension from pecl.
Here is an example .travis.yml file:
language: php
php:
- 5.6
before_script:
- pear config-set preferred_state beta
- yes '' | pecl install apcu
script:
- cd tests/ && phpunit
If you need a more complex solution, for example multiple php versions, you should be able to easily adopt the solution from the doctrine/cache repository ( https://github.com/doctrine/cache/blob/master/.travis.yml ). They run the tests against php 5.3 - 5.6 and hhvm with the following before_script:
[...]
before_script:
- [...]
- sh -c "if [[ $TRAVIS_PHP_VERSION != 'hhvm' && `php-config --vernum` -ge 50500 ]] ; then pecl config-set preferred_state beta; printf "yes\n" | pecl install apcu ; else echo 'extension="apc.so"' >> ./tests/travis/php.ini ;fi"
- [...]
[...]
Happy testing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.