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

How to install pdo_mysql extension in php

王林
Release: 2023-03-05 21:48:02
Original
2565 people have browsed it

How to install the pdo_mysql extension in php: 1. Compile and install pdo_mysql to generate mysql.so; 2. Open the php.ini configuration file and modify the configuration [extension=mysql.so]; 3. Restart apache.

How to install pdo_mysql extension in php

The specific method is as follows:

(Recommended tutorial: php video tutorial)

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
Copy after login

The following two parameters must be added. I did not add them at first, 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
Copy after login

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
Copy after login

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

extension=mysql.so
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template