I use Travis CI as a secondary continuous integration (CI) service to help ensure that each Simply Testable application works in isolation as expected when code changes are made.
The most straightforward course of action: increase the PHP memory limit in the Travis environment.
Each Travis build runs in a fresh virtual machine for which any form of shell access is not available. Simply finding and updating a configuration file isn’t an option.
Despite that, making the change is really easy. Here’s what you do.
Appending Any PHP Configuration Setting For Travis
Thankfully the Travis CI documentation is awesome and it provides a clear means of appending the standard PHP configuration with your own custom settings.
We can use this to set the PHP memory limit.
Setting the PHP Memory Limit for Travis CI
Create your custom ini file
I created a file named
travis.php.iniin the root of my project (at the same level as
Name yours however you choose and put it within your project wherever you choose; the above is just an example. The important part is to note the relative path to your ini file.
Add to your ini file any custom PHP configuration settings. These follow the same format as a regular php.ini file.
I added just the following:
memory_limit = 1024M
Update your project Travis configuration
You need to add
phpenv config-add <relative path to your ini file>to the
before_scriptsection of your
Here's an abridged copy of my current .travis.yml to show what that looks like:
language: php php: - 5.3 - 5.4 - 5.5 before_script: # Additional PHP config - phpenv config-add travis.php.ini # ... additional script lines script: - phpunit -c app
So long as yours looks similar to the above but retains the ini file naming you chose you should be fine.