Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the php.ini file support pdo abstraction layer

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to change php.ini files to support pdo abstraction layer". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Methods: 1, open the configuration file "php.ini"; 2, find "pdo_firebird", "pdo_oci", "pdo_odbc", "pdo_pgsql" and other PDO-related configuration information, and remove the semicolon in front of the configuration item; 3, restart the Apache server.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

What is PDO?

PDO is the abbreviation of PHP Date Object (PHP data object). It is a lightweight and consistent interface defined by PHP to access the database. It provides a data access abstraction layer, so that no matter what database you use, you can query and obtain data through the same function, which greatly simplifies the operation of the database and shields the differences between different databases.

PDO is released with PHP5.1 version. Using PDO, you can easily develop cross-database programs and migrate different databases. At present, the databases supported by PDO include Firebird, FreeTDS, Interbase, MySQL, SQL Server, ODBC, Oracle, Postgre SQL, SQLite and Sybase.

With PDO, you no longer need to use a series of functions of mysqli_*, you only need to use the methods in PDO to manipulate the database.

Turn on PDO

PDO is distributed with PHP5.1 and is included in PHP5.1 by default. Because PDO requires the support of PHP5's core object-oriented features, it cannot be used in previous versions of PHP5.0.

By default, PDO is turned on in PHP, but configuration actions are still required to enable support for a database driver.

Take the Windows system as an example, the configuration information related to PDO in the configuration file php.ini is as follows:

; extension=pdo_firebird;extension=php_pdo_mysql.dll;extension=pdo_oci;extension=pdo_odbc;extension=pdo_pgsql;extension=pdo_sqlite

Tip: you only need to remove the semicolon in front of the configuration item to open the corresponding configuration, and then restart the Apache server.

To verify whether the relevant configuration is enabled successfully, simply execute the phpinfo () function, and search for the name of the configuration in the output page. If it exists, it means the configuration is enabled successfully, as shown in the following figure:

This is the end of the content of "how to change the php.ini file support pdo abstraction layer". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report