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);.sofiles 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
- 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). - For MSSQL only β install the ODBC driver:
msiexec /i runtime\windows\msodbcsql18_x64.msi IACCEPTMSODBCSQLLICENSETERMS=YES(v18 recommended; v17 also included). - Match your PHP build (
php -iβ PHP Version, Thread Safety, Architecture) and copy the DLL(s) fromwindows/php<VER>/<ts|nts>/<arch>/into your PHPext\directory. - Enable in
php.ini:extension=php_mongodb.dll extension=php_sqlsrv.dll extension=php_pdo_sqlsrv.dll - Restart the web server / PHP-FPM; verify with
php -m.
Linux β RHEL / Rocky / Alma / CentOS 9
- 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 - Copy the
.sofor 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)/ - Enable via
.inifiles in your PHPconf.d:extension=mongodb.so extension=sqlsrv.so extension=pdo_sqlsrv.so 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 addextension=mongodb.so. - MSSQL: install the ODBC driver from
runtime/linux/debian12/msodbcsql18_*.deb(sudo ACCEPT_EULA=Y dpkg -i ...; needsunixodbcfrom base repo). Prebuiltsqlsrv.so/pdo_sqlsrv.sofor Debian are not in this bundle (Microsoft ships them as source only) β either reuse the RHEL 9.soif your glibc is compatible, or compile them withLINUX-MSSQL-BUILD.mdon a connected build box and copy the result in.
β οΈ Important notes
- glibc only. All Linux
.soare glibc builds β they will not run on musl distros (Alpine). On Alpine useapk add php<ver>-mongodb/ build against musl. - PHP minor must match exactly. A
php8.2.so/.dllonly 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
.soare 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)
- Windows DLLs: official PECL β https://downloads.php.net/~windows/pecl/releases/
- Linux mongodb.so (Debian 12): https://packages.sury.org/ (deb.sury.org)
- Linux .so (RHEL 9): Remi's RPM repository β https://rpms.remirepo.net/enterprise/9/
- MS ODBC Driver & Linux packages: https://packages.microsoft.com / download.microsoft.com
- VC++ Redistributable: https://aka.ms/vs/17/release/
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.