Home >Backend Development >PHP Tutorial >What is PDO and how to install it on Unix and Windows systems?
What is PDO? PDO is the abbreviation of PHP Data Object, which is a set of PHP extensions that provide core PDO classes and database-specific drivers. Provides a lightweight, vendor-neutral data access abstraction layer. Focus on data access abstractions, not database abstractions. PDO requires new object-oriented features to be added to the core of PHP 5, so it will not run in earlier versions of PHP.
Installing PDO
PDO is divided into two parts:
-The core that provides the interface.
- Drivers for specific access.
Installing PDO on Unix systems:
Since PHP 5.1.0, PDO (core) and PDO_SQLITE driver (SQLITE driver) are enabled by default. To access other databases, the PDO driver must be enabled.
To install PDO as a shared module, you need to update php.ini so that the PDO extension is automatically loaded when PHP is running. You will also need to enable other database-specific drivers, and they must be listed after the pdo.so line because PDO must be initialized before database-specific extensions can be loaded. If you build PDO and database-specific extensions statically, you can skip this step:
extension = pdo.so
Install PDO on Windows systems:
PDO and all major drivers The programs all come with PHP as a shared extension, you only need to edit the PHP .ini file to activate:
extension = php_pdo.dll
For PHP 5.3 and above, this step is unnecessary because PDO no longer requires the DLL.
Next, select the other database-specific DLL files and either load them at runtime using dl() or enable them in php.ini below php_pdo.dll.
To get the effect of the new configuration in the PHP.ini file, you need to restart PHP.
Related recommendations: "PHP Tutorial"
The above is the detailed content of What is PDO and how to install it on Unix and Windows systems?. For more information, please follow other related articles on the PHP Chinese website!