Home  >  Article  >  Backend Development  >  What is PDO

What is PDO

云罗郡主
云罗郡主Original
2019-01-12 15:26:4317226browse





What is PDO

##1: What is PDO

PDO 1 is the abbreviation of PHP Data Object (PHP Data Object) and is released together with PHP5.1 version. Currently supported databases Including Firebird, FreeTDS, Interbase, MySQL, MS SQL Server, ODBC, Oracle, Postgre SQL, SQLite and Sybase, etc.

2: Characteristics of PDO

1. Coding consistency

Since the various database extensions available for PHP are written by different publishers , so although all extensions provide basically the same features, they do not satisfy coding consistency. PDO eliminates this inconsistency and provides a single interface that can be used for various databases;

2. Flexibility

Because PDO loads the necessary database drivers at runtime, there is no need to Reconfigure and recompile PHP every time you use a different database. For example, if the database needs to be switched from SQL to MySQL, you only need to load the PDO_MYSQL driver.

3. Object-oriented features

PDO uses the object-oriented features of PHP5 to achieve more powerful and efficient database communication.

4. High performance

PDO is written in C and compiled to PHP, providing higher performance compared to other solutions written in PHP, although everything else is the same .

3: PDO installation

You can check whether the PDO extension is installed through PHP's phpinfo() function.

1.Install PDO on Unix system

On Unix or Linux you need to add the following extension:

extension=pdo.so

2.Install PDO on Windows

PDO and all major drivers are distributed with PHP as shared extensions. To activate them simply edit the php.ini file and add the following extension:

extension=php_pdo.dll

In addition, there are various corresponding ones: Database extension:

;extension=php_pdo_firebird.dll
;extension=php_pdo_informix.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll

After setting these configurations, we need to restart PHP or the Web server.






#

The above is the detailed content of What is PDO. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn