Home >Backend Development >PHP Problem >How to set up PDO extension in PHP?

How to set up PDO extension in PHP?

coldplay.xixi
coldplay.xixiOriginal
2020-07-23 15:47:126482browse

How to set up PDO extension in php: First open the [php.ini] configuration file; then find the [xtension=php_pdo.dll] and [extension=php_pdo_mysql.dll] statements and remove the previous [;] comments ;Finally restart apache.

How to set up PDO extension in PHP?

php settings method to enable pdo extension:

In Windows environment, in php 5.1 or above, pdo and The main database drivers are released with PHP as extensions. To activate them, simply edit the php.ini file.

Open the php.ini configuration file and find extension=php_pdo .dll (Configure the php configuration file, enable the corresponding extension) and extension=php_pdo_mysql.dll (Enable the extension to the corresponding database, take MySQL as an example), remove the previous ";" comment, and modify The last two lines of configuration content are as follows:

extension=php_pdo.dll
extension=php_pdo_mysql.dll

Finally, restart apache

You can see the details of the PDO extension by viewing phpinfo

<?php
phpinfo();

Run it and find pdo. If If you can see the information as shown in the picture, it means that the connection is successful. You can use

How to set up PDO extension in PHP?

Related learning recommendations: PHP Programming from Beginner to Master

The above is the detailed content of How to set up PDO extension in PHP?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn