Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
To connect to SQL Server from a PHP application, you need the following components installed in this order:
PHP runtime: Download and install PHP from php.net (Windows) or use your system package manager (Linux/macOS).
Microsoft ODBC Driver for SQL Server: The PHP drivers require the ODBC driver. Download it from Download ODBC Driver for SQL Server.
Microsoft Drivers for PHP for SQL Server: Download the drivers from Download the Microsoft Drivers for PHP for SQL Server. For more information on version compatibility, see System requirements for the Microsoft Drivers for PHP for SQL Server.
Web server (optional): Configure IIS (Windows) or Apache/Nginx (Linux/macOS) if you're building web applications.
Windows
Download and install PHP — use the Thread Safe (TS) version for IIS, or Non-Thread Safe (NTS) for Apache or CLI.
Download and install the ODBC Driver for SQL Server.
Download the Microsoft Drivers for PHP for SQL Server and extract the
.dllfiles to your PHP extensions directory.Enable the driver by adding the following lines to your
php.inifile:extension=php_sqlsrv.dll extension=php_pdo_sqlsrv.dllVerify the installation by running
php -mand checking thatsqlsrvandpdo_sqlsrvappear in the list.
For detailed instructions, see Loading the Microsoft Drivers for PHP for SQL Server. To configure IIS, see Download the Microsoft Drivers for PHP for SQL Server.
Linux and macOS
For step-by-step instructions on installing PHP, the ODBC driver, and the PHP drivers on Linux and macOS, see Linux and macOS Installation Tutorial for the Microsoft Drivers for PHP for SQL Server.