Hướng dẫn mssql php driver

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Tải xuống Microsoft Edge Xem thêm thông tin về Internet Explorer và Microsoft Edge

Đọc bằng tiếng Anh

Đọc bằng tiếng Anh Phản hồi Chỉnh sửa

Step 1: Configure environment for PHP development

  • Bài viết
  • 09/14/2022
  • 2 phút để đọc

Trong bài viết này

Hướng dẫn mssql php driver
Download PHP driver

  • Identify which version of the PHP driver you will use, based on your environment, as noted here: System Requirements for the Microsoft Drivers for PHP for SQL Server
  • Download and install applicable PHP Driver here: Download Microsoft PHP Driver
  • Download and install applicable ODBC Driver here: Download ODBC Driver for SQL Server
  • Configure the PHP driver and web server for your specific operating system:

Windows

  • Configure loading the PHP driver, as noted here: Loading the Microsoft Drivers for PHP for SQL Server
  • Configure IIS to host PHP applications, as noted here: Configuring IIS for the Microsoft Drivers for PHP for SQL Server

Linux and macOS

  • Configure loading the PHP driver and configure your web server to host PHP applications, as noted here: PHP Linux and macOS Drivers Installation Tutorial

Phản hồi

Gửi và xem ý kiến phản hồi dành cho

Sản phẩm này Trang này

Xem tất cả ý kiến phản hồi về trang

Trong bài viết này

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Overview of the Microsoft Drivers for PHP for SQL Server

  • Bài viết
  • 09/16/2022
  • 2 phút để đọc

Trong bài viết này

Download PHP driver

The Microsoft Drivers for PHP for SQL Server is a PHP extension that provides data access to SQL Server 2005 and later versions including Azure SQL Database. The extension provides a procedural interface with the SQLSRV driver and an object-oriented interface with the PDO_SQLSRV driver for accessing data in all versions of SQL Server, including Express, beginning with SQL Server 2005. Support for versions 3.1 and later of the drivers begins with SQL Server 2008. The Microsoft Drivers for PHP for SQL Server API includes support for Windows Authentication, transactions, parameter binding, streaming, metadata access, and error handling.

To use the Microsoft Drivers for PHP for SQL Server, you must have the correct version of SQL Server Native Client or Microsoft ODBC Driver installed on the same computer PHP is running. For more information, see System Requirements for the Microsoft Drivers for PHP for SQL Server.

In This Section

TopicDescription
Download drivers for PHP for SQL Server Links to download Microsoft Drivers for PHP for SQL Server.
Release Notes for the Microsoft Drivers for PHP for SQL Server Lists the features that were added for versions 4.0, 3.2, 3.1, 3.0, and 2.0.
Support Resources for the Microsoft Drivers for PHP for SQL Server Provides links to resources that can be helpful when you are developing applications that use the Microsoft Drivers for PHP for SQL Server.
About Code Examples in the Documentation Provides information that might be helpful when you run the code examples in this documentation.

Reference

SQLSRV Driver API Reference
PDO_SQLSRV Driver Reference
Constants (Microsoft Drivers for PHP for SQL Server)

See Also

Getting Started with the Microsoft Drivers for PHP for SQL Server
Programming Guide for the Microsoft Drivers for PHP for SQL Server
Example Application (SQLSRV Driver)

Phản hồi

Gửi và xem ý kiến phản hồi dành cho

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Nội dung chính

  • Getting Started with the Microsoft Drivers for PHP for SQL Server
  • Trong bài viết này
  • Getting Started
  • Phản hồi
  • Trong bài viết này
  • 1, Yêu cầu.
  • 3, Sử dụng thư viện.
  • 4, Lời kết.
  • 1. Download Oracle driver PHP - oci8
  • 1.2 Extract zip file:
  • 1.3. Add .ddl file to ext folder
  • 1.4 Add extention to php.ini
  • 1.5 Download the Oracle Instant Client Basic package from OTN.
  • 1.6 Add this subdirectory to the PATH environment variable.
  • 1.7 Check Oracle driver installed?
  • Kết luận

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Tải xuống Microsoft Edge Thông tin thêm

Đọc bằng tiếng Anh

Đọc bằng tiếng Anh Phản hồi Chỉnh sửa

Getting Started with the Microsoft Drivers for PHP for SQL Server

  • Bài viết
  • 09/09/2022
  • 2 phút để đọc

Trong bài viết này

Download PHP driver

This section provides information about the system requirements for using the Microsoft Drivers for PHP for SQL Server, and for loading the driver into the PHP process space.

Getting Started

  • Step 1: Configure development environment for PHP development
  • Step 2: Create a database for PHP development
  • Step 3: Proof of concept connecting to SQL using PHP
  • Step 4: Connect resiliently to SQL with PHP

See Also

Example Application (SQLSRV Driver)

Programming Guide for the Microsoft Drivers for PHP for SQL Server

SQLSRV Driver API Reference

Phản hồi

Gửi và xem ý kiến phản hồi dành cho

Sản phẩm này Trang này

Xem tất cả ý kiến phản hồi về trang

Trong bài viết này

Do mặc định PHP không hỗ trợ MongoDB, nên để có thể sử dụng được MongoDB trong dự án PHP thì chúng ta cần phải cài đặt và thiết lập nó vào trong PHP.

1, Yêu cầu.

Để có thể sử dụng được mongoDB trong dự án thì mọi người cần chú ý một vài điều sau:

  • MongoDB chỉ hỗ trợ PHP phiên bản 5.4 trở lên.
  • MongoDB yêu cầu bạn cần phải có ibbson, libmongoc . Và mặc định thì 2 cái này đều được tích hợp sẵn rồi.
  • Và cuối cùng là bạn phải có  OpenSSL.

Đầu tiên bạn cần truy cập vào link sau: https://pecl.php.net/package/mongodb/1.3.0/windows 

Tiếp đó bạn kéo xuống đến cuối trang và chọn một trong các tùy trọn gói sau:

Lưu ý: Nếu như bạn cài xampp thì core của PHP sẽ chạy bản 32 bit, tức là bạn cần phải tải các phiên bản X86.

Sau khi đã download xong thì các bạn cần copy file php_mongodb.dll và paste vào trong thư mục ext, thư mục này nằm trong thư mục cài đặt PHP của bạn (Nếu bạn cài Xampp thì nó sẽ nằm trong thư mục cài đặt xampp).

Tiếp đó bạn mở file php.ini lên (nằm trong thư mục cài đặt PHP) và thêm đoạn code sau vào đó.

extension=php_mongodb.dll

Như thế là bạn đã cài đặt thành công MongoDB driver vào trong PHP rồi. Tuy nhiên để có thể thực thi được MongoDB thì các bạn cần cài đặt thêm một thư viện do mongoDB phát triển nữa.

Lưu ý: Để có thể cài đặt được thư viện này thì mọi người cần phải cài đặt composer (Xem hướng dẫn cài composer).

Trong thư mục dự án, bạn mở cmd lên và gõ lệnh sau để cài đặt thư viện.

composer require mongodb/mongodb

Nếu như chương trình download thành công và không báo lỗi gì thì có nghĩa là bạn đã cài đặt thành công.

3, Sử dụng thư viện.

Sau khi đã cài đặt và download thành công thư viện về máy. Khi muốn sử dụng mongoDB, bạn cần phải require file autoload.php trong thư mục vendor vào trong file cần thực thi mongoDB.

VD

4, Lời kết.

Bài này, chúng ta tạm kết thúc ở việc cài đặt mongoDB driver vào trong PHP thôi các bài tiếp theo chúng ta sẽ thực thi truy vấn đến MongoDB.

Đăng ký nhận tin.

Chúng tôi chỉ gửi tối đa 2 lần trên 1 tháng. Tuyên bố không spam mail!

Bài Viết Mới

Đã đăng vào thg 3 23, 2019 11:40 SA 3 phút đọc

Chào các bạn, hôm nay mình muốn hướng dẫn các bạn cách thêm Oracle driver vào PHP module, với mục đích là PHP có thể kết nối đến cơ sở dữ liệu của Oracle.

Nào mình cũng bắt đầu nhé.

1. Download Oracle driver PHP - oci8

Đầu tiên các bạn cần downoad Oracle driver PHP đó là oci8 tại page https://pecl.php.net/package/oci8/2.2.0/windows

Ở đây có 3 phiên bản của PHP đó là 7.1, 7.2 và 7.3. Trong ví dụ của mình dùng 7.1 mình sẽ download 7.1 Thread Safe (TS) x86 .

1.2 Extract zip file:

Tiếp đến, sau khi download thành công oracle driver oci8, các bạn extract file zip sẽ nhận được các files như trong hình

1.3. Add .ddl file to ext folder

Trong folder download về, vì mình dùng Oracle 11g nên mình sẽ copy file php_oci8_11g.dll vào thư mục C:\xampp\php\ext\

Lưu ý: Thay đổi path đến xampp của các bạn nhé.

1.4 Add extention to php.ini

Kế đến các bạn tìm đến file php.ini của XAMPP C:\xampp\php\php.ini và thêm dòng extension=php_oci8_11g.dll vào

Bạn cần chắc chắn là extention_dir được trỏ chính xác đến thư mục extention của PHP để hạn chế lỗi nhé.

Như vậy các bạn đã thêm được oracle driver php vào php module. Kế đến để chạy được oracle driver bạn cần cài đặt instantclient-basic-nt của Oracle nữa.

1.5 Download the Oracle Instant Client Basic package from OTN.

Bạn truy cập vào page: https://www.oracle.com/technetwork/topics/winsoft-085727.html để dowload.

Click vào checkbox Accept License Agreement để được hiển thị link download

Kế đến bạn scroll xuống dưới và download file instantclient-basic-nt-11.2.0.3.0.zip

Sau khi download, extract file zip và copy vào thư mục C:\instantclient_11_2

1.6 Add this subdirectory to the PATH environment variable.

Kế đến bạn cần thêm C:\instantclient_11_2 vào biến môi trường PATH của window để chạy oracle driver.

Click vào start và tìm View Advanced system setttings

Tiếp đến, bạn click vào Advanced system settings trên menu bên trái

Tiếp đến, bạn click vào nút Environment Variables

Edit Path ở System Avariables, thêm C:\instantclient_11_2 và lưu lại

** Sau khi thêm biến môi trường, bạn cần khởi động lại máy tính để appy PATH đó.

1.7 Check Oracle driver installed?

Để kiểm tra Oracle driver PHP đã được cài đặt hay chưa, các bạn mở file C:\xampp\htdocs\info.php và thêm dòng sau vào:


Khởi động XAMPP, mở trình duyệt của bạn và vào page: http://localhost/info.php

** Nếu bạn nhìn thấy thông tin của oci8 như hình trên thì chúc mừng bạn đã cài đặt thành công Oracle driver.

Kết luận

Như vậy mình đã hướng dẫn xong cho các bạn cách thêm oracle driver oci8 vào PHP module. Giờ bạn có thể kết nối project của mình đến cơ sở dữ liệu Oracle rồi nhé.

Cảm ơn các bạn đã đọc bài viết của mình

All rights reserved