Real apps, verified end-to-end

Nine PHP applications on OxPHP, from Laravel to Magento. Each recipe is a complete Docker Compose project: the Dockerfile, the compose file, the install commands, and the OxPHP details the app's own docs don't mention.

Laravel

The canonical framework-mode application.

PHP
8.5
Routing mode
Framework
Services
MySQL
Install
composer create-project
The full recipe
docker-compose.yml
environment:  ENTRY_FILE: index.php

Notes

  • ENTRY_FILE=index.php selects framework mode: public/ becomes the document root, so .env, app/ and vendor/ are never reachable over HTTP.
  • Container environment overrides .env: Laravel's dotenv loader never overrides real environment variables, so DB_HOST and APP_ENV set in Compose win.
  • The dev image revalidates OPcache on every request, so edits on the bind-mounted src/ apply at once. For production, set opcache.validate_timestamps=0 and drop the bind mount.

Symfony

Minimal skeleton, no database.

PHP
8.5
Routing mode
Framework
Services
—
Install
composer create-project
The full recipe
docker-compose.yml
environment:  ENTRY_FILE: index.php

Notes

  • The skeleton runs on core extensions alone (ctype, iconv, xml); native intl and mbstring are added because real apps use them and they beat the polyfill.
  • APP_ENV comes from the container environment (Symfony reads real env vars over .env).
  • Static assets resolve to real files in public/ and are served from disk, falling through to index.php only on a miss.

Yii3

The leanest recipe of all.

PHP
8.5
Routing mode
Framework
Services
—
Install
composer create-project
The full recipe
docker-compose.yml
environment:  ENTRY_FILE: index.php

Notes

  • No database and no other services: one image, one process.
  • yiisoft/assets publishes static files into public/assets/<hash>/. They are real files on disk, so no URL rewriting is needed.

WordPress

Traditional mode with a WP-CLI sidecar.

PHP
8.5
Routing mode
Traditional
Services
MySQL
Install
WP-CLI
The full recipe
docker-compose.yml
environment:  PHP_DENY_PATHS: "/wp-content/uploads/**,/wp-content/cache/**,/wp-content/upgrade/**"

Notes

  • Traditional mode is mandatory: wp-admin/, wp-login.php and wp-cron.php must execute as physical files. ENTRY_FILE stays unset.
  • PHP_DENY_PATHS blocks .php execution under wp-content/uploads/, so a shell uploaded via a vulnerable plugin never runs. Paths are matched before disk I/O, which leaves no existence oracle.
  • CLI work goes through a WP-CLI sidecar sharing the same volume and database; wp-config.php reads credentials via getenv().

Drupal

Framework mode, PDO and drush.

PHP
8.4
Routing mode
Framework
Services
MySQL
Install
drush site:install
The full recipe
docker-compose.yml
environment:  DOCUMENT_ROOT: /var/www/html/web  ENTRY_FILE: index.php

Notes

  • Drupal's RewriteCond !-f + RewriteRule ^ index.php is exactly framework mode: serve existing files, dispatch the rest to web/index.php.
  • Aggregated CSS/JS under web/sites/default/files/ are served from disk as static files.
  • The cold first request warms Twig and Drupal's caches (~15 s); after that, responses take single-digit milliseconds.

Craft CMS

Console-driven install in framework mode.

PHP
8.5
Routing mode
Framework
Services
MySQL
Install
craft install
The full recipe
docker-compose.yml
environment:  DOCUMENT_ROOT: /var/www/html/web  ENTRY_FILE: index.php

Notes

  • Control-panel resources (web/cpresources/<hash>/) are real files on disk, served by framework mode.
  • Use MySQL 8.4 LTS, not 9. Craft is verified against 8.x.
  • Database settings come from the container environment (CRAFT_DB_*), so they live in Compose.

October CMS

A public/ mirror plus symlink allow-list.

PHP
8.4
Routing mode
Framework + mirror
Services
MySQL
Install
october:migrate + mirror
The full recipe
docker-compose.yml
environment:  ENTRY_FILE: index.php  SYMLINK_ALLOW_PATHS: /var/www/html

Notes

  • october:mirror public reproduces October's nginx asset whitelist: public/ holds only index.php and */assets symlinks; themes, config/, .env and vendor/ stay outside the webroot.
  • SYMLINK_ALLOW_PATHS=/var/www/html is required because the mirror's symlinks point back into the project tree, which OxPHP blocks by default.
  • Don't forget tailor:migrate: the demo theme's Tailor blueprints get their tables separately from october:migrate.

Magento

The heaviest: OpenSearch and a version symlink.

PHP
8.4
Routing mode
Framework
Services
MySQL + OpenSearch
Install
bin/magento setup:install
The full recipe
docker-compose.yml
environment:  DOCUMENT_ROOT: /var/www/html/pub  ENTRY_FILE: index.php

Notes

  • Versioned static URLs (/static/version<N>/…) need one self-referential symlink inside pub/static: nginx strips that segment with a rewrite rule, but OxPHP doesn't rewrite.
  • Run production mode: developer mode generates DI classes at request time, risking races across the multi-threaded worker pool.
  • MySQL needs --log_bin_trust_function_creators=1; composer install runs through the built PHP 8.4 image, not stock composer:2.

OpenCart

Two front controllers in traditional mode.

PHP
8.4
Routing mode
Traditional
Services
MySQL
Install
CLI installer
The full recipe
docker-compose.yml
environment:  DOCUMENT_ROOT: /var/www/html  PHP_DENY_PATHS: "/system/**,/install/**"

Notes

  • Two physical front controllers (index.php and admin/index.php) call for traditional mode; framework mode would funnel the admin into the storefront controller.
  • The webroot is the project root, so PHP_DENY_PATHS=/system/**,/install/** blocks direct execution of internals; dotfiles already answer 404 by default.
  • Default query routing (index.php?route=…) works with zero rewrite rules.

What every recipe shares

Every recipe settles the same four things. How it settles them is what carries over to an app that isn't on the list.

  • Built on the published image

    Eight of the nine Dockerfiles copy the oxphp binary, liboxphp_bridge.so and the SAPI extension from ghcr.io/oxphp/oxphp into a php:<X.Y>-zts-alpine base. WordPress builds on the OxPHP image itself. Either way, the PHP ABI and the Alpine release must match the tag: compile your app's extensions on the php:<X.Y>-zts-alpine<release> base it was built on.

  • Routing mode follows the app's shape

    One front controller under public/ → framework mode. Several physical entry points → traditional mode. ENTRY_FILE is the switch: set it for the first, leave it unset for the second.

  • One default, two settings

    Dot-path blocking answers 404 for .env, .git/ and any other dot path, with nothing to set. The other two are settings a recipe turns on: PHP_DENY_PATHS keeps .php from running in WordPress's uploads and in OpenCart's system/ and install/, and SYMLINK_ALLOW_PATHS lets October's asset symlinks resolve while every other symlink out of the webroot stays blocked.

  • Install through the same container

    The dev image carries the PHP CLI and Composer, so artisan, drush and bin/magento run through docker compose exec, without a separate toolchain. WordPress is the exception: its image has no wp binary, so WP-CLI runs in a sidecar.

Your stack isn't on the list?

If every request goes through one index.php, the app runs in framework mode. Start from the Laravel recipe, add the PHP extensions your app needs, and point DOCUMENT_ROOT at the directory that holds index.php if it isn't public/.