Preinstalled php versions in Haxe image

According to https://docs.travis-ci.com/user/reference/xenial/#php-support, there should be php 5.6, 7.1, and 7.2 preinstalled.

But from my build log, it is not so. Output of phpenv versions:

* system (set by /home/travis/.phpenv/version)
  hhvm
  hhvm-stable

I am having the same issue. I’m trying to run some PHP scripts while building a Rust language project, but I can’t seem to find a working version of PHP on Xenial.

My .travis.yml file looks something like this:

language: rust
sudo: false
dist: xenial

cache:
  - cargo

rust:
  - stable

before_install:
  - phpenv versions
  - php --version

before_script:
  - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
  - (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.3" mdbook)
  - cargo install-update -a

script:
  - php tools/toc.php
  - mdbook build

Different languages use different images. Preinstalled versions are documented for the corresponding language image. There’s no guarantee that they are going to be the same for other language images.

See e.g. https://github.com/travis-ci/docs-travis-ci-com/pull/2413/files for the differences in preinstalled Python versions.

Though it would probably be easier for everyone if they were the same.

I figured out a way to accomplish what I needed, using the generic image:

language: generic
sudo: false
dist: xenial

php: 7.2.15

cache:
  directories:
    - /home/travis/.cargo
    - /home/travis/build/phpcommunity/phplang.org/target
    - /home/travis/.rustup
    - /home/travis/.cache/sccache

install:
  - curl -sSf https://build.travis-ci.org/files/rustup-init.sh | sh -s -- --default-toolchain=stable -y

before_script:
  - export PATH=${TRAVIS_HOME}/.cargo/bin:$PATH
  - rustc --version
  - rustup --version
  - cargo --version
  - php --version
  - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
  - (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.3" mdbook)
  - cargo install-update -a

script:
  - ...

deploy:
  ...