How to enable mysqlnd for php?

2019-01-06 14:08发布

I have PHP installed and running (version: 5.3.17) and I want to switch to mysqlnd (in the phpinfo mysqlnd does not exist at all).

I read that in order to set it, you need to update the ./configure command:

./configure --with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \

When I tried installing it with yum install php-mysqlnd I get an error:

---> Package php-mysqlnd.x86_64 0:5.3.17-1.26.amzn1 will be installed
--> Processing Conflict: php-mysql-5.3.17-1.26.amzn1.x86_64 conflicts php-mysqlnd
--> Finished Dependency Resolution
Error: php-mysql conflicts with php-mysqlnd

5条回答
我只想做你的唯一
2楼-- · 2019-01-06 14:55

Don't know if i understand you right.... Simply download the source of php (php-5.x.x.tar.gz), unzip the source and change to that directory then

 bash:/dir/of/your/source # ./configure --with-mysql=... and your other config params

after that just make it by

 bash:/dir/of/your/source # sudo make && make install
查看更多
再贱就再见
3楼-- · 2019-01-06 15:05

As of PHP 5.4, the mysqlnd library is a php.net compile time default to all PHP MySQL extensions. - Ref: dev.mysql.com

it would be a little easier to use XAMPP for Linux 1.8.1(it comes with PHP 5.4.7) then compiling from source.

查看更多
Root(大扎)
4楼-- · 2019-01-06 15:07
yum swap php-mysql php-mysqlnd
查看更多
何必那么认真
5楼-- · 2019-01-06 15:09

yum install php-mysqlnd is only available on CentALT and maybe remi repos. Webtatic also has some good php repos as well. It is NOT on the default ones (I was using CentOS).

查看更多
Evening l夕情丶
6楼-- · 2019-01-06 15:14

The ./configure command is part of the compilation process from source code.

You can either compile from source or install via package manager. I guess in your case the package manager is preferable.

As the package manager complains, you can’t have both php-mysql and php-mysqlnd installed.

So you can

yum remove php-mysql

before

yum install php-mysqlnd

Then check for success via

php -m | grep mysqlnd

or

php -i | grep mysqlnd
查看更多
登录 后发表回答