We use PHPENV to manage PHP versions. We currently have 5.3, 5.4, 5.5, 5.6, 7.0 and 7.1 installed. These are aliases that are pointing to the specific 5.x.x and 7.x.x versions we have installed.

For a full list of installed versions (including patch level versions) open a SSH debug build and run the following command

phpenv versions

Ubuntu 14.04

By default we use 5.5

Specific versions: 5.3.29, 5.4.45, 5.5.38, 5.6.29, 7.0.14 and 7.1.0

Do not rely on the specific versions we have as this can change any time and could break your build.

You can change the version you want to use by running phpenv local PHP_VERSION in your setup commands. For example

phpenv local 5.5


You can access and change the php.ini file in

/home/rof/.phpenv/versions/$(phpenv version-name)/etc/php.ini

Dependencies and Extensions

You can install dependencies through pear and composer. Extensions can be installed through pecl. If you need any other tools please send us a message.


By default xdebug is installed and enabled on the build VMs. If you want to remove it, add the following command to your builds.

rm -f /home/rof/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini


pear install pear/PHP_CodeSniffer


composer install --no-interaction


If you want cache composer dependencies during builds, please add the following environment variable to your build configuration.


To make sure that the dependency cache is used by all of your dependencies, please call composer via the following snippet.

composer install --prefer-dist  --no-interaction

GitHub API

To speed up Composer you can install packages from dist by replacing --prefer-source with --prefer-dist. However as GitHub’s API is rate limited, you then might see errors similar to this:

- Installing phpunit/phpunit (3.7.37)
Downloading: connection... Failed to download phpunit/phpunit from dist: Could not authenticate against`
Now trying to download from source

To avoid this create a new personal access token on GitHub. For the description you can use something like Codeship Composer and you can unselect all scopes. Copy your personal access token and add it to the environment variables in your Codeship project settings (on the Environment page) as GITHUB_ACCESS_TOKEN.

Then use the following Setup Commands in your Codeship project settings:

composer config -g $GITHUB_ACCESS_TOKEN
composer install --prefer-dist --no-interaction


As we already have a version of PHPUnit preinstalled on our build VMs, you need to remove this version first, before upgrading to a different version via Composer.

composer global remove phpunit/phpunit
composer global require phpunit/phpunit:5.*


pecl install -f memcache

phpenv rehashing

If you install a new executable through a pear package make sure to run

phpenv rehash

so phpenv is aware of the new executable and sets it up correctly

Running your PHP Server

If you want to test against a running PHP Server you can use the builtin one to start a server in the current directory. It will serve files from this directory.

nohup bash -c "php -S 2>&1 &" && sleep 1; cat nohup.out

You can access it in your tests on

Also take a look at the PHP built-in webserver docs in the PHP documentation

Thanks to Jeff Donios for the tip.


Codeship supports essentially all popular PHP frameworks.

Supported Frameworks

Some of the most popular PHP frameworks used on Codeship are:

  • Laravel
  • Symfony
  • CodeIgniter
  • CakePHP

These are not the only frameworks that will work, though. Most PHP frameworks will work without issue, as long as there are no extensions required that we do not install on the build machines.

Using Frameworks

Using most frameworks is no different than using any other technology, you simply need to configure your setup and test commands.

Note that all commands must return an exit code 0 to Codeship to report a successful result, or any other error code to report an unsuccessful result. This means you must configure your test scripts to exit with a 0 status if they do not do so by default.

Parallelization Modules

In addition to parallelizing explicitly via parallel pipelines, some customers have found using the [paratest] module is a great way to speed up your tests.

Note that we do not officially support or integrate with this module and that it is possible for this to cause resource and build failure issues, as well.

Need More Help?

Get in touch if you need more help, or post on Stack Overflow using the tag #Codeship.

  • Ask The Helpdesk A Question
  • Code Examples And Sample Projects
    • Was This Article Helpful?