Home  >  Article  >  Database  >  How to Enable MySQLnd Extension in PHP?

How to Enable MySQLnd Extension in PHP?

Susan Sarandon
Susan SarandonOriginal
2024-11-18 19:48:02130browse

How to Enable MySQLnd Extension in PHP?

How to Enable MySQLnd Extension for PHP

Scenario: You have PHP 5.3.17 installed and desire to switch to the MySQLnd extension.

Solution: There are two methods to install MySQLnd:

1. Package Management

For yum-based systems:

  • Remove the conflicting php-mysql package: yum remove php-mysql
  • Install php-mysqlnd: yum install php-mysqlnd

For apt-based systems:

  • Remove the conflicting php5-mysql package: apt-get remove php5-mysql
  • Install php5-mysqlnd: apt-get install php5-mysqlnd

2. Source Compilation (Not Recommended)

  • Download the PHP source code and extract it.
  • Edit the configure script:

    ./configure --with-mysql=mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd
  • Compile and install PHP: make && make install

Checking for Success

Run any of the following commands to verify the installation:

  • php -m | grep mysqlnd
  • php -i | grep mysqlnd

If the output includes mysqlnd, the extension has been successfully enabled.

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