MrSimonEmms
MrSimonEmms

Reputation: 1481

Why won't APC work in PHP v5.5 on Travis-CI?

So, I'm writing a PHP programme that uses APC for it's caching mechanism. I'm using TravisCI for my continuous integration and testing it on PHP 5.3, 5.4 and 5.5. The tests for APC pass for v5.3 and 5.4, but fail on 5.5 with the following message...

PHP Warning: PHP Startup: Unable to load dynamic library
'/home/travis/.phpenv/versions/5.5.0beta1/lib/php/extensions/no-debug-non-zts-20121212/apc.so' - /home/travis/.phpenv/versions/5.5.0beta1/lib/php/extensions/no-debug-non-zts-20121212/apc.so:
cannot open shared object file: No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library
'/home/travis/.phpenv/versions/5.5.0beta1/lib/php/extensions/no-debug-non-zts-20121212/apc.so' - /home/travis/.phpenv/versions/5.5.0beta1/lib/php/extensions/no-debug-non-zts-20121212/apc.so:
cannot open shared object file: No such file or directory in Unknown on line 0

My .travis.yml file looks like this

## YAML Template.
---
language: php
php:
  - "5.5"
  - "5.4"
  - "5.3"
before_script: phpenv config-add tests/config.ini
script: phpunit --configuration phpunit.xml

My tests/config.ini file looks like this

extension="apc.so"

apc.enabled=1
apc.enable_cli=1

Can anyone shed some light as to why I can get APC working in v5.3 and 5.4, but not in 5.5? Is this an issue with PHP, or an issue with Travis?

Upvotes: 2

Views: 1508

Answers (3)

Herman J. Radtke III
Herman J. Radtke III

Reputation: 1812

Here is a working solution, that I am using successfully right now: https://gist.github.com/till/7266839

Essentially this will install APC for 5.3 and 5.4 and will install APCu for 5.5.

Upvotes: 2

andig
andig

Reputation: 13868

With PHP5.5, the built-in OpCache is replacing the APC byte coding caching functionality. However, OpCache is not a "general" cache like MemCache or APC. To get the old non-bytecode caching functionality back you need to install APCu which is APC minus the byte-code caching.

Upvotes: 0

mcuadros
mcuadros

Reputation: 4144

You need to compile the APCu extension on travis, remember APC is not available in PHP 5.5 anymore.

You can try in your .travis.yml

printf "\n"| pecl install apcu
echo "extension=apcu.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

Regards.

Upvotes: 0

Related Questions