CircleCI Precise to Trusty Upgrade for SF2

While upgrading my CircleCI instance for my Symfony2 application I hit a few bumps due to the configuration changes.

I’m a big fan of continuous integration and leverage CircleCI for a few projects. Back in Febuary 2016 they released a Ubuntu Trusty (14.04 LTS) image which in my opinion is a great step up from the Ubuntu Precise (12.04 LTS) image. I waited until this past week to upgrade and hit a few snags on my Symfony2 application. A quick list of what I ran into and how I fixed it is below.

Change the PHP Version

The Precise image supported 5.5.21, the Trusty image supports 5.5.31 to switch a simple change in your circle.yml is needed

machine:
  php:
    version: 5.5.32

Change the Path for any PHP INI changes

The path for all the PHP ini configuration files has changed from ~/.phpenv/versions/ to /opt/circleci/php/. If you modify or append any PHP configuration changes be sure to update your circle.yml file.

PECL extensions that are installed manually are no longer automatically enabled

If you install a PECL extension be sure to enable it manually in Trusty by echoing it to a INI file that is loaded. As an example of installing the imagick extension would look like the following in your circle.yml:

- printf "\n" | pecl install imagick
- echo "extension=imagick.so" >> /opt/circleci/php/$(phpenv global)/etc/php.ini

Be sure to do this for each PECL extension that you install.

Update your PECL memcached configuration

If you install the memcached extension the configuration will be a bit different than Precise. You are now able to install the latest version but will require some support libraries through apt in addition to passing a flag to the compiler.

- - printf "\n" | pecl install memcached
+ - sudo -s apt-get install libmemcached-dev
+ - printf "no --disable-memcached-sasl \n" | pecl install memcached

Set your PHP timezone

The timezone is not set for you on the Trusty image, so simply set it yourself in the circle.yml file:

pre:
  - echo "date.timezone = UTC" > /opt/circleci/php/$(phpenv global)/etc/conf.d/date.ini

Assuming you have done the above, your phpunit tests for SF2 should now be running again!