chu*_*Dub 6 php mysql pdo centos
我知道在stackoverflow中有几个这个问题的实例,但我找不到解决方案.
我正在使用Apache和PHP 5.3运行CentOS
.php脚本给了我这个错误:
Fatal error: Class 'PDO' not found in ...
Run Code Online (Sandbox Code Playgroud)
我跑了phpinfo();,页面上唯一存在"pdo"的地方是"配置命令" '--disable-pdo'行.
我试过,#yum install php-pdo但没有包.
我也试过#pecl install pdo,我最后得到这些错误:
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_instantiate':
/root/tmp/pear/PDO/pdo_dbh.c:410: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c:411: error: 'zval' has no member named 'is_ref'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_construct':
/root/tmp/pear/PDO/pdo_dbh.c:435: error: 'zend_fcall_info' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c:458: error: 'zend_fcall_info_cache' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'zim_PDO_setAttribute':
/root/tmp/pear/PDO/pdo_dbh.c:752: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'zim_PDO_getAttribute':
/root/tmp/pear/PDO/pdo_dbh.c:818: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_hash_methods':
/root/tmp/pear/PDO/pdo_dbh.c:1122: warning: assignment discards qualifiers from pointer target type
/root/tmp/pear/PDO/pdo_dbh.c:1126: warning: assignment discards qualifiers from pointer target type
make: *** [pdo_dbh.lo] Error 1
ERROR: `make' failed
Run Code Online (Sandbox Code Playgroud)
然后在php.net doc上,它基本上说自PHP 5.1以来,该软件包已成为php安装的标准配置.
我将该行添加extension=pdo.so到php.ini并重新启动Apache,问题仍然存在.有什么建议?
我也有类似的问题。我正在使用 codeigniter 并收到“pdo_mysql.so not found”错误,并尝试了一切方法来修复它。我必须在 google 搜索结果的前 10 页中进行多个查询的搜索。我发现很多人都有同样的问题,但由于某种原因,他们都没有答案/解决办法。通过所有这些阅读,我了解到“从 PHP 5.1.0 开始默认启用 PDO 和 PDO_SQLITE 驱动程序。 ”这让我想到,“也许我应该从我的 php 中删除 extension=pdo_mysql.so 和 pdo.so 行。伊尼!” 我认为 php 正在尝试加载一个不再存在的扩展,因为它现在是内置的。果然,解决了我所有的 php 错误问题。
PHP 5.4.31 (cli)(构建:2014 年 8 月 19 日 10:38:48)
Zend Engine v2.4.0,版权所有 (c) 1998-2014 Zend Technologies
服务器版本:Apache/2.2.27 (Unix)
服务器构建:8 月 19 日2014 10:33:30
Cpanel::Easy::Apache v3.26.5 rev9999