Frequently Asked Questions
Frequently Asked Questions
General Questions
What is Cbox Base Images?
Cbox Base Images is a collection of production-ready Docker images for PHP applications. We provide:
- 40+ PHP extensions pre-installed and optimized
- Three tiers: Slim (APIs), Standard (most apps), Full (Browsershot/Dusk)
- PHP versions: 8.2, 8.3, 8.4, 8.5
- Architecture types: Single-process (PHP-FPM, PHP-CLI, Nginx) and Multi-service (PHP-FPM + Nginx)
- Development variants with Xdebug pre-configured
- Framework auto-detection for Laravel, Symfony, and WordPress
How is Cbox different from other PHP Docker images?
| Feature | Cbox | php:official | serversideup |
|---|---|---|---|
| Extensions pre-installed | 40+ | ~10 | 30+ |
| Multi-service containers | Yes | No | Yes (S6) |
| Process manager | Cbox Init (Go) | None | S6 Overlay |
| Framework detection | Yes | No | Yes |
| Development variants | Yes | No | Yes |
| Weekly security rebuilds | Yes | Varies | Yes |
Key differentiator: Cbox uses Cbox Init, a lightweight Go-based process manager instead of S6 Overlay, resulting in simpler debugging, smaller image sizes, and built-in Prometheus metrics.
Which image should I use?
For most Laravel/Symfony projects: php-fpm-nginx:8.4-bookworm
- Smallest image size (~120MB)
- Both PHP-FPM and Nginx in one container
- Auto-configures for your framework
For Kubernetes/microservices: Separate php-fpm + nginx images
- Better horizontal scaling
- Independent resource limits
For development: php-fpm-nginx:8.4-bookworm-dev
- Includes Xdebug pre-configured
- Development PHP settings (errors visible)
Installation & Setup
How do I get started quickly?
# Pull the latest image
docker pull ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
# Run with your Laravel project
docker run -d \
-p 8080:80 \
-v $(pwd):/var/www/html \
ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
How do I use the development image with Xdebug?
# docker-compose.yml
services:
app:
image: ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm-dev
ports:
- "8080:80"
- "9003:9003" # Xdebug port
volumes:
- .:/var/www/html
environment:
XDEBUG_MODE: debug,develop,coverage
XDEBUG_CONFIG: client_host=host.docker.internal client_port=9003
PHP_IDE_CONFIG: serverName=docker
What PHP extensions are included?
Core extensions (always available):
- opcache, pdo_mysql, pdo_pgsql, mysqli, pgsql
- redis, imagick, apcu, mongodb
- zip, intl, bcmath, gd, exif
- pcntl, sockets, soap, xsl, ldap, imap
Run php -m to see all enabled extensions in your container.
See Available Extensions for the complete list.
Configuration
How do I customize PHP settings?
Option 1: Environment variables (runtime)
environment:
PHP_MEMORY_LIMIT: 512M
PHP_UPLOAD_MAX_FILESIZE: 100M
PHP_POST_MAX_SIZE: 100M
PHP_MAX_EXECUTION_TIME: 300
Option 2: Custom php.ini (build time)
FROM ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
COPY custom.ini /usr/local/etc/php/conf.d/99-custom.ini
How do I customize Nginx?
Replace the default config:
FROM ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
COPY nginx.conf /etc/nginx/conf.d/default.conf
Or use environment variables (template-based):
environment:
NGINX_WEBROOT: /var/www/html/public
NGINX_CLIENT_MAX_BODY_SIZE: 100M
NGINX_FASTCGI_READ_TIMEOUT: 300s
How do I enable the Laravel scheduler?
environment:
LARAVEL_SCHEDULER: "true"
This automatically sets up cron to run php artisan schedule:run every minute. Older configs that still export LARAVEL_SCHEDULER_ENABLED continue to work, but LARAVEL_SCHEDULER is the canonical flag going forward.
Performance
What performance optimizations are included?
-
OPcache - Fully configured for production
opcache.memory_consumption=256opcache.max_accelerated_files=50000opcache.jit_buffer_size=128M(PHP 8.x)
-
Realpath Cache - 20-30% performance improvement
realpath_cache_size=4096Krealpath_cache_ttl=600
-
Nginx Optimizations
open_file_cacheenabled- Gzip compression configured
- Static asset caching
-
PHP-FPM - Production-tuned pool settings
How do I monitor performance?
Cbox Init provides built-in metrics:
# Check process status
docker exec myapp cbox-init status
# View metrics (Prometheus format)
curl http://localhost:9100/metrics
Why is my container slow on first request?
First requests trigger:
- OPcache warming
- Framework bootstrapping
- File caching
Solution: Enable warm-up in production:
environment:
LARAVEL_AUTO_OPTIMIZE: "true" # Runs optimize on startup
Security
What security features are included?
-
HTTP Security Headers
- X-Frame-Options: SAMEORIGIN
- X-Content-Type-Options: nosniff
- Cross-Origin-Opener-Policy: same-origin
- Cross-Origin-Embedder-Policy: require-corp
- Permissions-Policy (camera, microphone, etc. disabled)
-
Nginx Protections
- Hidden files blocked (
.env,.git) - Sensitive directories blocked (
vendor,node_modules) - PHP execution blocked in upload directories
- Version headers hidden
- Hidden files blocked (
-
PHP Security
expose_php = Off- Dangerous functions disabled
open_basedirready
-
ImageMagick Policy
- XXE prevention
- Ghostscript exploits blocked
- SSRF protection
How do I add Content-Security-Policy?
CSP is intentionally not set by default (too application-specific). Add it in your Dockerfile or custom nginx config:
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'" always;
Is the /health endpoint secure?
Yes! The /health endpoint is restricted to localhost only:
location /health {
allow 127.0.0.1;
allow ::1;
deny all;
}
Kubernetes/Docker health checks work because they run inside the container.
Troubleshooting
Container starts but site shows 502 Bad Gateway
Cause: PHP-FPM isn't running or Nginx can't connect.
Fix:
# Check if PHP-FPM is running
docker exec myapp ps aux | grep php-fpm
# Check PHP-FPM logs
docker exec myapp cat /var/log/php-fpm.log
# Verify socket/port
docker exec myapp netstat -tlnp | grep 9000
Permission denied errors on Laravel
Cause: storage/ and bootstrap/cache/ aren't writable.
Fix: Cbox auto-fixes this, but if it persists:
docker exec myapp chown -R www-data:www-data /var/www/html/storage
docker exec myapp chmod -R 775 /var/www/html/storage
Xdebug not connecting to IDE
Checklist:
- Port 9003 is exposed:
-p 9003:9003 XDEBUG_MODE=debugis setclient_host=host.docker.internal(Docker Desktop) or your host IP- IDE is listening on port 9003
- Path mappings are correct in IDE
OPcache changes not reflecting
Development: Set OPCACHE_VALIDATE_TIMESTAMPS=1
Production: Restart container after deployment:
docker restart myapp
# Or inside container:
kill -USR2 1 # Graceful reload
Container won't start - "exec format error"
Cause: Wrong architecture (ARM vs AMD64).
Fix: Specify platform:
docker pull --platform linux/amd64 ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
Updates & Maintenance
How often are images updated?
- Weekly security rebuilds every Monday at 03:00 UTC
- PHP version updates within 48 hours of release
- Extension updates as needed
How do I update my images?
# Pull latest
docker pull ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
# Rebuild your image
docker-compose build --pull
# Restart containers
docker-compose up -d
How do I pin to a specific version?
Use SHA-based tags for reproducibility:
image: ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm@sha256:abc123...
Rolling tags (8.4-bookworm) get weekly security updates automatically.
Migration
Migrating from serversideup images?
Key differences:
- No S6 Overlay - services managed by bash entrypoint
- Different environment variable names (check docs)
- Config paths may differ
Migration steps:
- Update
image:in docker-compose.yml - Review environment variables
- Test locally before production
Migrating from official PHP images?
Cbox includes everything from official images plus:
- 40+ extensions pre-installed
- Nginx bundled (multi-service)
- Framework auto-detection
- Production optimizations
Simply change your FROM line:
# Before
FROM php:8.4-fpm-bookworm
# After
FROM ghcr.io/cboxdk/php-baseimages/php-fpm-nginx:8.4-bookworm
Getting Help
Where can I report issues?
GitHub Issues: github.com/cboxdk/baseimages/issues
How do I contribute?
- Fork the repository
- Create a feature branch
- Submit a pull request
See Contributing Guide for details.