PHP 7 is now out, and Travis-CI supports it as part of their standard configuration (rather than forcing you to use the PHP nightly build). Last night I submitted a pull request to add PHP 7 support to the Known Travis build, which was a little bit problematic.
Known uses Apache + PHP-FPM, rather than the Travis default nginx setup, and while there are guides for getting this working on the Travis site, it seems that they’re not quite there for the PHP 7 build.
The PHP 7 build was running into this error:
[15-Feb-2016 23:14:58] WARNING: Nothing matches the include pattern '/home/travis/.phpenv/versions/7.0.3/etc/php-fpm.d/*.conf' from /home/travis/.phpenv/versions/7.0.3/etc/php-fpm.conf at line 125. [15-Feb-2016 23:14:58] ERROR: No pool defined. at least one pool section must be specified in config file [15-Feb-2016 23:14:58] ERROR: failed to post process the configuration [15-Feb-2016 23:14:58] ERROR: FPM initialization failed /home/travis/build.sh: line 45: 25862 Segmentation fault (core dumped) ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
This took a little while to diagnose, but in the end the fix was pretty simple. Basically it looks like the Travis PHP7 build of PHP-FPM expects, but can not find, a pool definition. You don’t need to customise it, just put a default one into PHP-FPM’s config directory.
So, I packaged a default template with the Known patch, and in my .travis.yml
added the following to before_script
:
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then sudo cp Tests/build/www.conf ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/; fi
I also modified the Apache vhost example and added ServerName localhost
to the definition (although this might not be needed).
After this, the build completes successfully.
PHP7 is new, so I suspect Travis will fix this shortly. However, hopefully this will prevent some hair-pulling in the mean time!
Thanks! Works perfectly.
Why is in the vhost-file still php5 mentioned while this should work with php7?
Hi Marcus, thanks for your post about fixing Apache + PHP development environment on Travis CI build.
And it help me a lot on this PR https://github.com/izniburak/php-router/pull/21 :).
To paf, the php5 can be replaced with php and it can refer my vhost file(https://github.com/izniburak/php-router/blob/master/tests/fixtures/travis-ci-apache) on my contributed repository.