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

How to install pdo_mysql extension in php

王林
王林 Original
2020-11-02 11:45:00 2063browse

How to install the pdo_mysql extension in php: 1. Compile and install the mysql extension to generate mysql.so; 2. Edit the php.ini configuration file and add mysql.so; 3. Compile and install pdo_mysql.

How to install pdo_mysql extension in php

Installation method:

(Recommended tutorial:php video tutorial)

1. Installation 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

Only required here Write --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 php-config and mysql could not be found respectively. header file.

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

The error is 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

Related recommendations:php training

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