PDO Configuration and Enablement

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.