Skip to main content

What is docker-php-mssql?

docker-php-mssql provides production-ready Docker images that combine the official PHP Docker images with Microsoft SQL Server drivers. These images eliminate the complex setup process of installing and configuring the ODBC drivers and PHP extensions needed to connect PHP applications to Microsoft SQL Server databases.

Key Features

Pre-configured SQL Server Drivers

Microsoft ODBC Driver 18 with sqlsrv and pdo_sqlsrv extensions already installed and configured

Multiple PHP Versions

Support for PHP 8.1, 8.2, 8.3, and 8.4 with both CLI and FPM variants

Rich Extension Set

Includes commonly used extensions: bcmath, ds, exif, gd, intl, opcache, pcntl, redis, and zip

Development Tools

CLI images include Composer, Node.js, npm, and Yarn for complete development workflows

Architecture Variants

Alpine Linux

Lightweight images based on Alpine Linux, ideal for production deployments where image size matters.
FROM php:8.4-cli-alpine
# Includes Microsoft ODBC Driver 18
# Pre-installed sqlsrv and pdo_sqlsrv extensions

Debian Bookworm

Standard Debian-based images providing broader compatibility and familiar tooling.
FROM php:8.4-cli
# Debian Bookworm base
# Microsoft ODBC Driver 18 from official Microsoft repositories

Swoole Variants

Specialized Alpine images with the Swoole PHP extension for high-performance async programming.

Image Types

Command-line interface images designed for:
  • Running scripts and background jobs
  • Development and testing
  • CI/CD pipelines
  • Laravel Artisan, Symfony Console applications
Additional tools included:
  • Composer (latest stable)
  • Node.js 22.x
  • npm and Yarn
  • nano text editor
  • pcov for code coverage
FastCGI Process Manager images optimized for:
  • Production web applications
  • Integration with Nginx or Apache
  • High-performance web serving
  • Containerized microservices
Optimized for production:
  • Minimal tooling footprint
  • Efficient process management
  • Ready for orchestration platforms

Available PHP Extensions

All images include these pre-installed and configured extensions:
ExtensionPurpose
sqlsrvNative Microsoft SQL Server driver
pdo_sqlsrvPDO driver for SQL Server
bcmathArbitrary precision mathematics
dsEfficient data structures
exifImage metadata reading
gdImage manipulation
intlInternationalization
opcachePerformance optimization
pcntlProcess control (CLI only)
pcovCode coverage (CLI only)
redisRedis client
zipArchive manipulation

Supported Versions

Images are automatically rebuilt and retagged weekly to include the latest upstream PHP updates and security patches.
The project currently maintains images for:
  • PHP 8.4 - Latest stable release
  • PHP 8.3 - Current stable version
  • PHP 8.2 - Active support
  • PHP 8.1 - Security fixes only
Each version is available in:
  • Alpine CLI and FPM variants
  • Debian CLI and FPM variants
  • Alpine Swoole CLI and FPM variants (8.1-8.4)
PHP 7.3, 7.4, and 8.0 images are discontinued and no longer receive updates. These versions should not be used in production.

Use Cases

Laravel Applications

Perfect for Laravel applications that need to connect to SQL Server databases, with all required extensions and Composer pre-installed.

Symfony Projects

Fully compatible with Symfony applications, including console commands and web applications.

Legacy System Integration

Ideal for modernizing applications that need to integrate with existing SQL Server databases.

Microservices

Lightweight Alpine images are perfect for containerized microservices architectures.

License

The project is licensed under the MIT License, making it free for both personal and commercial use.

Build docs developers (and LLMs) love