Home >Backend Development >PHP Tutorial >PDO drivers缺少功能怎么办

PDO drivers缺少功能怎么办

PHPz
PHPzOriginal
2016-06-06 20:48:232157browse

PDO drivers缺少功能怎么办

PDO drivers缺少功能怎么办?

具体问题:

ii  libapache2-mod-php5               5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (Apache 2 module)
ii  libsqlite3-0                      3.7.17-1+debphp.org~precise+2       SQLite 3 shared library
ii  php-pear                          5.3.10-1ubuntu3.8                   PEAR - PHP Extension and Application Repository
ii  php5                              5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (metapackage)
ii  php5-cgi                          5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                          5.3.10-1ubuntu3.8                   command-line interpreter for the php5 scripting language
ii  php5-common                       5.3.10-1ubuntu3.8                   Common files for packages built from the php5 source
ii  php5-curl                         5.3.10-1ubuntu3.8                   CURL module for php5
ii  php5-dev                          5.3.10-1ubuntu3.8                   Files for PHP5 module development
ii  php5-gd                           5.3.10-1ubuntu3.8                   GD module for php5
ii  php5-mysql                        5.3.10-1ubuntu3.8                   MySQL module for php5
ii  php5-odbc                         5.3.10-1ubuntu3.8                   ODBC module for php5
ii  php5-sqlite                       5.3.10-1ubuntu3.8                   SQLite module for php5
ii  php5-sybase                       5.3.10-1ubuntu3.8                   Sybase / MS SQL Server module for php5

安装了这些包。按照我以往的经验应该在phpinfo()中得到一下的驱动

PDO drivers dblib, mysql, odbc, sqlite

但是只得到了

PDO drivers mysql

请问可能是什么问题?会与apache的配置有关吗?

解决办法:

原因是:你装错包了

php5-mysql包对应的是mysql_*系列函数,如mysql_query(),这个包与pdo无关。

如果你要用pdo操作mysql,就要安装这两个包:php5-pdo php5-pdo_mysql,不需要php5-mysql。

同理,pgsql, sybase, sqlite等数据库的pdo支持对应的包名是:php5-pdo_pgsql, php5-pdo_sybase, php5-pdo_sqlite

更多相关技术文章,请访问PHP中文网

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