无法启用pdo_sqlite

时间:2015-05-18 11:18:23

标签: php linux sqlite

我已经运行sudo apt-get install php5-sqlitephpinfo()显示已安装sqlite3,但当我尝试连接到它时,我得到:

PDOException::could not find driver

当我在apache2 php.ini文件中启用它时

extension = pdo_sqlite.so 
extension = sqlite.so 

它不会改变任何东西。而且 - 当我将这些相同的行添加到cli php.ini中时,我得到了

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_sqlite.so' - /usr/lib/php5/20121212/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/sqlite.so' - /usr/lib/php5/20121212/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0

我已经没想完了。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

解决方案:

首先加载 PHP pdo模块,更正 apt dist-upgrade 之后损坏的CLI符号链接:

php -v
PHP 5.5.9-1ubuntu4.22 (cli) (built: Aug  4 2017 19:40:28)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

注意:通过Web浏览器,phpinfo()返回所有模块都加载没有错误,所以我比较/ etc / php5 / cli与/ etc / php5 / apache2看看有什么区别

<强>后:

/etc/php5/cli/conf.d# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_pgsql.so' - /usr/lib/php5/20121212/pdo_pgsql.so: undefined symbol: pdo_parse_params in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_sqlite.so' - /usr/lib/php5/20121212/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_odbc.so' - /usr/lib/php5/20121212/pdo_odbc.so: undefined symbol: pdo_parse_params in Unknown on line 0

<强>之前:

在我的 Ubuntu 14.04 LTS 64位上出现以下警告:

{{1}}