The PDO (PHP Data Object) extension is added in PHP5, and PHP6 connects the database with PDO, and all non-PDO extensions will be removed from the extension in PHP6. The extension provides PHP built-in class PDO to access the database, different databases use the same method name, to solve the problem of non-uniform database connection.
PDO's goal is to provide a lightweight, clear, and convenient API to unify the common features of various RDBMS libraries, but not to exclude more advanced features.
Provides an optional, large degree of abstraction/compatibility through PHP scripting.
Features of PDO: performance. PDO has learned from the outset the successes and failures of existing database extensions. Because PDO's code is brand new, we have the opportunity to start designing performance again to take advantage of the latest features of PHP 5.
PDO is designed to provide the basis for common database functionality while providing easy access to the unique features of the RDBMS.
PDO is designed to make it easy to use your database. The API does not force you into your code, and it clearly shows the process of each function call.
The PDO extension is modular, allowing you to load drivers at run time for your database backend without having to recompile or reinstall the entire PHP program. For example, the Pdo_oci extension implements the Oracle database API instead of the PDO extension. There are also drivers for MySQL, PostgreSQL, ODBC, and Firebird, and more drivers are still being developed.
In the Windows environment PHP 5.1 and above, the PDO and the main database driver with PHP as an extension release, to activate them just need to simply edit the php.ini file.
Open the PHP.ini configuration file, locate the Extension=php_pdo.dll (Configure PHP config file, open the appropriate extension) and Extension=php_pdo_mysql.dll (open the extension to the corresponding database, take MySQL as an example), remove the previous “;” , the modified two-line configuration reads as follows:
Extension=php_pdo.dllextension=php_pdo_mysql.dll
Finally, restart Apache
You can see the details of the PDO extension by looking at the Phpinfo
<? PHP Phpinfo ();
Run, find PDO, if you can see the information that indicates the connection was successful, you can use
PDO Configuration and Enablement