Using PHP 8.2 on TravisCI

Ran into this recently, and it seems that TravisCI has PHP 8.2 support but only on Ubuntu 20.04 Focal Fossa and it’s missing a library. Hints on this forum post.

The gist is that dist: focal has to be set as well as an extra package installed form apt. Without the apt package, an error occurs:

php: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory

Here’s the same config, this could go at the top level of the file.

language: php

php: "8.2"

dist: focal

addons:
  apt:
    packages:
      - libonig5

Or nested under jobs.include:

jobs:
  include:
    - stage: test
      language: php
      php: "8.2"
      dist: focal
      addons:
        apt:
          packages:
            - libonig5