Home >Backend Development >PHP Problem >How to install pdo_mysql extension in php

How to install pdo_mysql extension in php

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-14 18:48:332513browse

Method: 1. Download and decompress the php installation package and install the pdo component; 2. Use the cd command to enter the "pdo_myqsl" component directory, specify the "php-config" path and mysql installation path, and use "make & make install "Just install pdo_mysql.

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

1. Install PDO components

Unzip the php installation package, enter the pdo component directory, create the php plug-in module through phpize, specify the php-config path, and install pdo.

cd /usr/local/download/php-5.6.23/ext/pdo
phpize
./configure --with-php-config=/usr/local/app/php/bin/php-config
make & make install

2. Install the PDO_MYSQL component

Enter the pdo_myqsl component directory, create a php plug-in module through phpize, specify the php-config path and mysql installation path, and install pdo_mysql.

cd /usr/local/download/php-5.6.23/ext/pdo_mysql
phpize
./configure --with-php-config=/usr/local/app/php/bin/php-config  --with-pdo-mysql=/usr/
make & make install

There are some pitfalls in specifying the mysql path here, because I installed mysql using yum. I passed the find / -name mysql and service mysqld status commands. The mysql path found is not correct and an error message is displayed.

#提示msyql没找到checking for mysql_config... not found
configure: error: Unable to find your mysql installation#提示没有mysql_queryconfigure: error: mysql_query missing!?

Later I saw that others had successfully installed it using --with-pdo-mysql=/usr/. I tried the same and it worked.
If you downloaded the installation package from http://pecl.php.net/package/PDO_MYSQL, decompress the installation file and follow the command in step 2.

Recommendation: "2021 PHP interview questions summary (collection)" "php video tutorial"

The above is the detailed content of How to install pdo_mysql 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