Home>Article>Backend Development> How to install pdo_mysql in php

How to install pdo_mysql in php

藏色散人
藏色散人 Original
2020-08-06 10:19:31 2322browse

How to install "pdo_mysql" in php: first use yum to install mysql client; then use the find command to find the mysql client installation directory; then compile and install, and generate "mysql.so"; finally modify the php configuration file , and add "mysql.so".

How to install pdo_mysql in php

Recommended: "PHP Video Tutorial"

php Install pdo_mysql

First install the mysql client

Then install the php mysql extension

1. Install the mysql client and mysql development package

Use yum to install the mysql client

Go to the mysql official website to download the yum file

https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

Install the mysql yum warehouse

# rpm -ivh mysql57-community-release-el5-8.noarch.rpm

Install the mysql client

# yum install mysql-community-client.x86_64

View the installation results

# mysql -V mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper

2 .Install php mysql extension

# cd /usr/local/php-5.3.28/ext/mysql/ # phpize # ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr

Note: --with-mysql=/usr This parameter

Use the find command to find the mysql client installation directory

# find / -name mysql.h /usr/include/mysql/mysql.h

You only need to write here --with-mysql=/usr

Compile and install, generate mysql.so

#make #make install

Modify the php.ini configuration file, add mysql.so

extension=mysql.so

Restart apache

2. Install pdo_mysql

# cd /usr/local/php-5.3.28/ext/pdo_mysql/ # phpize # ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql

The following two parameters must be added. I did not add them at the beginning, but the result was that the header files of php-config and mysql could not be found.

# ./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysql

The error is reported as follows: It says that the zlib directory cannot be found, just add this sentence -with-pdo-mysql=/usr/local/mysql

Compile and install, generate mysql.so

#make #make install

Modify the php.ini configuration file and add mysql.so

extension=mysql.so

Restart apache

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