php 与 mariadb 一起使用什么 PDO 驱动程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20898711/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What PDO driver to use with mariadb?
提问by Question Overflow
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 中出现消息“找不到驱动程序”的未捕获异常“PDOException”\n堆栈跟踪:\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
PDOException “could not find driver”
我已经通读了以下两个相关问题,但在那里找不到答案:
PDO 和 MariaDB
PDOException “could not find driver”
yum list pdo_mysql, yum list php5-mysql, yum list php5-mariadball returns no matching package. What is the name of the PDO driver for mariadb to be used on Fedora 20 (red hat)?
yum list pdo_mysql, yum list php5-mysql, yum list php5-mariadball 返回没有匹配的包。要在 Fedora 20(红帽)上使用的 mariadb 的 PDO 驱动程序的名称是什么?
Just to add, php-pdois already installed.
补充一下,php-pdo已经安装好了。
采纳答案by Question Overflow
回答by Dmitriy.Net
MarriaDB is branch of mysql. For installation PDO driver for it, install php-pdo and php-mysql packages
MarriaDB 是 mysql 的一个分支。为它安装 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

