Ivan Kerin
Ivan Kerin

Reputation: 141

Travis CI with Apache & PHP

How to configure travis-ci to use phpenv's php version in Apache?

phpenv's README states that ~/.phpenv/lib/libphp5.so is set whenever "phpenv global" is called, however when I try to configure apache to use this as its apxs library I get this:

Travis outputs:

/home/travis/build/OpenBuildings/Clippings/.phpenv/lib/libphp5.so: cannot open shared object file: No such file or directory

I don't think using "apt-get install libapache2-mod-php5" is the right call as I would rather use the specifically set php version from travis' config.

My config so far is:

before_script:
  - sudo apt-get update
  - sudo apt-get install -y --force-yes apache2
  - echo "extension=memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - printf "\n" | pecl install imagick
  - echo "LoadModule php5_module $(pwd)/.phpenv/lib/libphp5.so" | sudo tee /etc/apache2/mods-available/php5.load
  - sudo cp build/travis/etc/apache2/clippings /etc/apache2/sites-available/clippings
  - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/clippings
  - sudo a2ensite clippings
  - sudo a2enmod rewrite
  - sudo a2enmod php5
  - sudo service apache2 restart

Upvotes: 4

Views: 1411

Answers (1)

Ivan Kerin
Ivan Kerin

Reputation: 141

Apparently there are 2 "phpenv" libraries, and travis is using the other one. So after a bit of digging I managed to configure appache successfully with php-fpm (which is supported by travis)

I've made a pull rquest for travis-ci docs to reflect my findings, and it's already merged to master: http://about.travis-ci.org/docs/user/languages/php/

Upvotes: 4

Related Questions