简体   繁体   English

什么PDO驱动程序与mariadb一起使用?

[英]What PDO driver to use with mariadb?

After replacing mysql with mariadb, I encountered the following error: 用mariadb替换mysql后,我遇到以下错误:

PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /var/www/inlcude/config.php:5\\nStack trace:\\n#0 /var/www/inlcude/config.php(5): PDO->__construct('mysql:dbname=my...', 'apache', 'ABCDE...')\\n#1 /var/www/html/index(21): require('/var/www/inlcude/con...')\\n#2 {main}\\n thrown in /var/www/inlcude/config.php on line 5 PHP致命错误:/var/www/inlcude/config.php:5 \\ nStack trace中的消息“找不到驱动程序”的未捕获异常“PDOException”:\\ n#0 /var/www/inlcude/config.php(5 ):PDO - > __ construct('mysql:dbname = my ...','apache','ABCDE ...')\\ n#1 / var / www / html / index(21):require('/ var /www/inlcude/con...')\\n#2 {main} \\ n在第5行的/var/www/inlcude/config.php中抛出

I have read through the following two related questions, but can't find the answer there: 我已经阅读了以下两个相关问题,但在那里找不到答案:
PDO and MariaDB PDO和MariaDB
PDOException “could not find driver” PDOException“找不到驱动程序”

yum list pdo_mysql , yum list php5-mysql , yum list php5-mariadb all returns no matching package. yum list pdo_mysqlyum list php5-mysqlyum list php5-mariadb all返回没有匹配的包。 What is the name of the PDO driver for mariadb to be used on Fedora 20 (red hat)? 在Fedora 20(red hat)上使用mariadb的PDO驱动程序的名称是什么?

Just to add, php-pdo is already installed. 刚添加,已经安装了php-pdo

By trial and error, it turns out that I need to install mysqlnd to get the PDO driver. 通过反复试验,我发现我需要安装mysqlnd来获取PDO驱动程序。

yum install php-mysqlnd

Don't ask me why or how it works because I have absolutely no idea. 不要问我为什么或如何运作,因为我完全不知道。

MarriaDB is branch of mysql. MarriaDB是mysql的分支。 For installation PDO driver for it, install php-pdo and php-mysql packages 要安装PDO驱动程序,请安装php-pdo和php-mysql软件包

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

And after this you can install pdo and mysql from remi repositories 在此之后,您可以从remi存储库安装pdo和mysql

yum --enablerepo=remi install php-pdo
yum --enablerepo=remi install php-mysql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM