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的配置有关吗?

apache2.2 php pdo

無限D剣製 11 years, 11 months ago

原因是: 你装错包了

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

jichi answered 11 years, 11 months ago

Your Answer