当前位置:Gxlcms > PHP教程 > PDOdrivers缺少功能

PDOdrivers缺少功能

时间:2021-07-01 10:21:17 帮助过:39人阅读

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

回复内容:

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.ini里有打开扩展么

人气教程排行