Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install PDO on CentOS

I know there is several instances of this question throughout stackoverflow but I am not finding a solution.

I am running CentOS with Apache and PHP 5.3

A .php script is giving me this error:

Fatal error: Class 'PDO' not found in ...

I ran phpinfo(); and the only place "pdo" exists on the page is in the "Configure Command" '--disable-pdo' line.

I attempted #yum install php-pdo but no packages exist.

I also attempted #pecl install pdo and i get these errors at the end:

/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

Then on the php.net doc it basically says the package comes standard in php installations since PHP 5.1.

I added the line extension=pdo.so to php.ini and restarted Apache and the problem persists. Any suggestions?

like image 383
chuckieDub Avatar asked Oct 10 '13 17:10

chuckieDub


1 Answers

I too have had a similar issue. I am using codeigniter and was getting a "pdo_mysql.so not found" error and tried everything to fix it. I must of searched thru the first 10 pages of google search results for multiple queries. I found tons of people with the same problems but for some reason none of them had an answer/fix. Thru all this reading I learned that "PDO and the PDO_SQLITE driver is enabled by default as of PHP 5.1.0." This got me thinking, "Perhaps I should remove the extension=pdo_mysql.so and pdo.so lines from my php.ini!" I figured php was trying to load an extension that was no longer there since it comes built in now. Sure enough, solved all my php error mess.

PHP 5.4.31 (cli) (built: Aug 19 2014 10:38:48)
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Server version: Apache/2.2.27 (Unix)
Server built: Aug 19 2014 10:33:30
Cpanel::Easy::Apache v3.26.5 rev9999

like image 60
Nate Avatar answered Oct 02 '22 00:10

Nate