What is PDO? PDO PDO characteristics and a method of mounting

What is PDO?

PDO is PHP Date Object (PHP Data Objects) for short, which is released together with PHP5.1 version, currently supports databases including Firebird, FreeTDS, Interbase, MySQL, MS SQL Server, ODBC, Oracle, Postgre SQL, SQLite and Sybase, etc., with PDO, the user will not have to use mysql_ * function, aco_ * mssql_ * function or functions, then they do not have encapsulated database operations, the method only requires the use of PDO interface may be different databases operation, the choice of a different database, only need to modify the PDO DNS (database name) on it.

Use the default in PHP 6 PDO connect to the database, all non-PDO extension will be removed in PHP 6, the built-in classes PDO PHP extension provides access to the database, different databases using the same method name, so as to solve the database connection is not consent issues. Linear motor manufacturer

PDO is characterized by

(1) PDO is a "database access abstraction layer," the role of various databases access interface, compared to mssql mysql libraries and libraries, PDO allow cross-database use more affinity, compared with ADODB and MDB2, PDO is more efficient.

(2) PDO through a light, clear and convenient function, a total unity of the various RDBMS database, PHP script to achieve the greatest degree of abstraction and compatibility.

(3) PDO draw expand existing databases success and failure lessons, take advantage of the latest features of PHP5, you can easily interact with a variety of databases.

(4) PDO extension is modular, so can load the drivers for your back-end database at runtime, without having to recompile or install the entire PHP program. For example: PDO_MySQL extension will replace the PDO extension implement MySQL database API. There are some for Oracle, PostgreSQL, ODBC and Firebird drivers, more drivers are under development.

POD installation

PDO is released together with the PHP5.1, included by default in PHP5.1 installation files, because the PDO requires PHP 5 object-oriented features support, and therefore it can not be used before the 5.0 version of PHP.

By default, PDO is not turned on in PHP5.2 the state, but to enable support for any database drivers, need to throw the appropriate configuration operations, methods configured in different operating system environments are as follows:

(1) in the Linux environment, to use the MySQL database. You can re-configure command to add the following options:

1

--with-pdo-mysql=/path/to/mysql/installation

(2) In the Windows environment, enable PDO need to be configured in the php.ini file, to enable PDO must first load "extension = php_pdo.dll", its support if it is to a specific database, but also the corresponding record database options, for example, to support the MySQL database, you also need to load "extension = php_pdo_mysql.dll" option.

note:

Upon completion of loading the database, save the php.ini file, restart Apache server modifications to take effect!

Guess you like

Origin www.cnblogs.com/furuihua/p/12172688.html