PHP MongoDB & MSSQL Extensions β€” Offline Bundle (Windows + Linux)

A self-contained, air-gap-ready bundle of prebuilt PHP extension binaries for MongoDB and Microsoft SQL Server (sqlsrv + pdo_sqlsrv), plus every runtime dependency normally downloaded from the internet at install time. Designed to be copied into an isolated network with no internet access.

Covers PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 on Windows (x64 + x86) and Linux (x86_64).

Clarifications on the original request

  • There is no "PHP 7.46" β€” PHP 7.x ended at 7.4.33. This bundle targets PHP β‰₯ 7.4.
  • On Windows PHP extensions are .dll (php_mongodb.dll, php_sqlsrv.dll, php_pdo_sqlsrv.dll); .so files are Linux-only. Both are provided, correctly per-OS.

What's in the box

Component Windows Linux
mongodb extension βœ… 7.4–8.4, x64+x86, TS+NTS βœ… 7.4–8.4 (RHEL 9 + Debian 12)
sqlsrv extension βœ… 7.4–8.4, x64+x86, TS+NTS βœ… 7.4–8.4 (RHEL 9)
pdo_sqlsrv extension βœ… 7.4–8.4, x64+x86, TS+NTS βœ… 7.4–8.4 (RHEL 9)
MS ODBC Driver (MSSQL runtime dep) βœ… v17 + v18, x64+x86 (MSI) βœ… v17 + v18 (Debian .deb + RHEL .rpm)
Visual C++ Redistributable (DLL runtime dep) βœ… x64 + x86 n/a

109 files, ~156 MB. Every binary is listed with a SHA-256 in SHA256SUMS.


Directory layout

windows/php<VER>/<ts|nts>/<x64|x86>/php_mongodb.dll
                                    /php_sqlsrv.dll
                                    /php_pdo_sqlsrv.dll

linux/rhel9/php<VER>/x64/mongodb.so          # RHEL/Rocky/Alma/CentOS 9  (complete: all 3 exts)
                        /sqlsrv.so
                        /pdo_sqlsrv.so
linux/debian12/php<VER>/x64/mongodb.so       # Debian 12 / Ubuntu        (mongodb only)

runtime/windows/  msodbcsql18_x64.msi  msodbcsql18_x86.msi
                  msodbcsql17_x64.msi  msodbcsql17_x86.msi
                  VC_redist.x64.exe    VC_redist.x86.exe
runtime/linux/debian12/  msodbcsql18_*.deb  msodbcsql17_*.deb
runtime/linux/rhel9/     msodbcsql18-*.rpm  msodbcsql17-*.rpm

SHA256SUMS
LINUX-MSSQL-BUILD.md    # fallback: build sqlsrv/pdo_sqlsrv on other distros

ts = Thread-Safe (Apache mod_php); nts = Non-Thread-Safe (php-fpm / FastCGI / CLI β€” the usual pick). Check yours: php -i | grep "Thread Safety" (Linux) or php -i | findstr "Thread" (Windows).


Offline install

Windows

  1. Install the VC++ redistributable once per machine (required for the DLLs to load): run runtime/windows/VC_redist.x64.exe (and/or the x86 one for 32-bit PHP).
  2. For MSSQL only β€” install the ODBC driver: msiexec /i runtime\windows\msodbcsql18_x64.msi IACCEPTMSODBCSQLLICENSETERMS=YES (v18 recommended; v17 also included).
  3. Match your PHP build (php -i β†’ PHP Version, Thread Safety, Architecture) and copy the DLL(s) from windows/php<VER>/<ts|nts>/<arch>/ into your PHP ext\ directory.
  4. Enable in php.ini:
    extension=php_mongodb.dll
    extension=php_sqlsrv.dll
    extension=php_pdo_sqlsrv.dll
    
  5. Restart the web server / PHP-FPM; verify with php -m.

Linux β€” RHEL / Rocky / Alma / CentOS 9

  1. For MSSQL only β€” install the ODBC driver (offline):
    sudo ACCEPT_EULA=Y rpm -i runtime/linux/rhel9/msodbcsql18-*.rpm
    # requires unixODBC from your base OS media/repo:  sudo dnf install unixODBC
    
  2. Copy the .so for your PHP version to the extension dir (php-config --extension-dir, e.g. /usr/lib64/php/modules/):
    sudo cp linux/rhel9/php8.3/x64/{mongodb.so,sqlsrv.so,pdo_sqlsrv.so} $(php-config --extension-dir)/
    
  3. Enable via .ini files in your PHP conf.d:
    extension=mongodb.so
    extension=sqlsrv.so
    extension=pdo_sqlsrv.so
    
  4. php -m | grep -Ei 'mongodb|sqlsrv' to verify.

Linux β€” Debian 12 / Ubuntu

  • mongodb is provided under linux/debian12/php<VER>/x64/mongodb.so β€” copy it to your extension dir (php -i | grep extension_dir) and add extension=mongodb.so.
  • MSSQL: install the ODBC driver from runtime/linux/debian12/msodbcsql18_*.deb (sudo ACCEPT_EULA=Y dpkg -i ...; needs unixodbc from base repo). Prebuilt sqlsrv.so / pdo_sqlsrv.so for Debian are not in this bundle (Microsoft ships them as source only) β€” either reuse the RHEL 9 .so if your glibc is compatible, or compile them with LINUX-MSSQL-BUILD.md on a connected build box and copy the result in.

⚠️ Important notes

  • glibc only. All Linux .so are glibc builds β€” they will not run on musl distros (Alpine). On Alpine use apk add php<ver>-mongodb / build against musl.
  • PHP minor must match exactly. A php8.2 .so/.dll only loads in PHP 8.2.
  • Base-OS dependency: the MSSQL extensions require unixODBC (Linux) β€” a standard base-repo package β€” in addition to the Microsoft ODBC driver included here. It's usually already installed.
  • Mixing distros: the RHEL 9 and Debian 12 .so are ABI-compatible for the same PHP minor on most modern glibc systems, but for production prefer the set matching your actual distro.

Version summary

PHP Win mongodb Win sqlsrv/pdo Linux mongodb (rhel9 / deb12) Linux sqlsrv/pdo (rhel9)
7.4 1.20.1 5.10.0 1.20.1 / 1.20.1 5.10.1
8.0 1.20.1 5.10.0 1.20.1 / 1.20.1 5.11.1
8.1 2.4.1 5.12.0 2.4.1 / 2.1.4 5.12.0
8.2 2.4.1 5.12.0 2.4.1 / 2.1.4 5.12.0
8.3 2.4.1 5.13.3 2.4.1 / 2.1.4 5.13.3
8.4 2.4.1 5.13.3 2.4.1 / 2.1.4 5.13.3

ODBC driver: v18.6.2.1 + v17 (17.10.6.1 Win / 17.11.1.1 Linux). VC++ Redist: VS2015–2022 (17.x).

Sources & provenance (all unmodified upstream)

Verify integrity with sha256sum -c SHA256SUMS (Linux) or CertUtil -hashfile <file> SHA256 (Windows).

Licenses

  • MongoDB PHP extension β€” Apache-2.0
  • Microsoft Drivers for PHP for SQL Server (sqlsrv, pdo_sqlsrv) β€” MIT
  • Microsoft ODBC Driver & Visual C++ Redistributable β€” Microsoft EULA (redistributed for offline convenience; by installing you accept Microsoft's license terms). All trademarks belong to their respective owners. This repo is an unofficial convenience mirror.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support