A small, self-contained PHP + Apache sample built on SUSE's SLE BCI
php-apache base image, replacing the older
php-apache
example in sle-bci-containers
with an updated, leaner mold shared with the other *-sle-bci samples
(aspnet-8-sle-bci,
wildfly-sle-bci, ...).
The original php-apache sample layered on a lot of bespoke, subscription-gated
plumbing (an SUSEConnect registration, the sle-module-legacy extension, a
Microsoft package repo for mssql-tools, an Oracle Instant Client RPM
install) just to demonstrate PECL drivers most PHP apps never touch. This
version drops all of that: everything it installs comes straight from the
public repo the bci/php-apache image already has configured, no SUSE
subscription needed.
- Base image:
registry.suse.com/bci/php-apache— Apache +mod_php, pre-loaded withcurl,mbstring,openssl,session,zip - Extra extensions layered on top:
pdo+sqlite(for the sample app's visit counter),opcache,gd,intl— the last two are literally the upstream image's own "how to add extensions" example - Composer, installed via the official installer script with its signature verified before it runs
- A tiny sample app (
app/index.php) that reads/writes a SQLite database throughPDOon every request — proof the container's writable storage and thepdo_sqliteextension both actually work, not just that PHP boots app/phpinfo.php(classicphpinfo()) andapp/healthz.php(JSON health endpoint listing loaded extensions), for parity with the other samples in this repo
versions.json is the source of truth: it lists every PHP
tag this repo builds and which one gets the floating latest tag. CI reads
this file and builds one image per entry.
| PHP tag | Image tags |
|---|---|
8 |
8, latest |
bci/php-apache currently only publishes a single major-version tag (8,
pinned to whatever PHP 8.3.x point release SUSE ships that month — there's
no per-minor 8.1/8.2/8.3 split upstream), so versions.json has one
entry today. It's still a list, and CI still drives entirely off it, so
adding a second major version later (once/if SUSE publishes one) is just a
new entry — see "Updating" below.
Dockerfile # parameterized image definition (PHP_TAG build arg)
versions.json # source of truth: which PHP tags get built
app/
index.php # sample page: extension list + SQLite visit counter
phpinfo.php # classic phpinfo()
healthz.php # JSON health check
screenshots/ # for this README
Every push to main builds and publishes all versions listed in
versions.json to GitHub Container Registry via
.github/workflows/build.yml:
podman pull ghcr.io/doccaz/php-apache-sle-bci:latest
podman pull ghcr.io/doccaz/php-apache-sle-bci:8 # exact major tagpodman build --build-arg PHP_TAG=8 -t php-apache-sle-bci:8 .Omitting the build arg falls back to the Dockerfile default (PHP_TAG=8,
currently the only tag bci/php-apache publishes).
podman run -d --name php-demo -p 8080:80 ghcr.io/doccaz/php-apache-sle-bci:latestThen:
curl http://localhost:8080/ # visit counter, increments each call
curl http://localhost:8080/healthz.php # JSON: php version, sapi, loaded extensionsOpen http://localhost:8080/ in a browser to see the visit counter and the full list of loaded extensions:
And http://localhost:8080/phpinfo.php for the full phpinfo() output:
Like the base image itself, you can skip the build entirely and mount your own code straight into the document root:
podman run -d -p 8080:80 -v ./your-app/:/srv/www/htdocs:Z \
registry.suse.com/bci/php-apache:8- Confirm SUSE has actually published a new major tag for
bci/php-apache(checkregistry.suse.com/repositories/bci-php-apacheor query the registry'stags/listAPI — the upstream image has historically only ever carried a single8tag). - Build and smoke-test it locally before touching
versions.json:podman build --build-arg PHP_TAG=<tag> -t php-apache-sle-bci:test . podman run -d --name php-test -p 18080:80 php-apache-sle-bci:test curl -i http://127.0.0.1:18080/ curl -i http://127.0.0.1:18080/healthz.php podman rm -f php-test
- Add an entry to
versions.jsonwith the confirmedphp_tagandmajortag string, moving"latest": trueto whichever entry should own the floatinglatesttag (only one entry should have it). - Push to
main— CI builds and publishes every entry inversions.json, including the new one.
Drop your own PHP files into app/ (replacing or adding to the existing
ones) and rebuild — the Dockerfile copies everything in that directory into
/srv/www/htdocs. If your app needs extra extensions, add them to the
zypper install line in the Dockerfile; check what's available first with
zypper se php8 inside the base image (no SUSE subscription required for
anything in the base image's own repo).
SUSE periodically republishes bci/php-apache against newer point releases.
Nothing to change here — the next CI run on main rebuilds against
whatever the tag currently resolves to. To force a local rebuild against the
latest point release:
podman pull registry.suse.com/bci/php-apache:8
podman build --pull --build-arg PHP_TAG=8 -t php-apache-sle-bci:8 .- Builds cleanly with no SUSE subscription/registration of any kind
gd,intl,pdo,pdo_sqlite,opcacheall load correctly alongside the base image's built-incurl/mbstring/openssl/session/zip- Composer installs and reports its version correctly
/persists and increments a request counter across repeated calls viaPDO+ SQLite, confirming both the extension and the container's writable storage work (the base image runs Apache's worker processes aswwwrun, not root — the app'sdata/directory ischowned towwwrun:wwwin the Dockerfile so that user can write to it, no world-writable permissions needed)/healthz.phpreturns valid JSON with the full loaded-extension list/phpinfo.phprenders the standardphpinfo()page
.github/workflows/build.yml reads
versions.json, then builds and pushes one image per entry to
ghcr.io/doccaz/php-apache-sle-bci on every push to main and on manual
dispatch; pull requests build every version but don't push. The workflow
uses the repo's own GITHUB_TOKEN, so no extra secrets are needed.
The published package inherits this repository's visibility, so it's
pullable anonymously — no podman login/docker login needed. If that
ever changes, visibility can be set explicitly from the package's GitHub
settings page
(github.com/doccaz/php-apache-sle-bci/pkgs/container/php-apache-sle-bci →
Package settings → Change visibility).
Licensed under the GNU General Public License v3.0.

