Cannot install PDO on CentOS

I know that there are several examples of this question in stackoverflow, but I can not find a solution.

I am running CentOS with Apache and PHP 5.3

A.PHP script gives me this error:

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

I ran phpinfo(); , and the only place where "pdo" is located is in the line "Configure Command" '--disable-pdo' .

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

I also tried #pecl install pdo and I will 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 the php.net document basically says that the package is included in the standard php installation with PHP 5.1.

I added the extension=pdo.so to php.ini and restarted Apache and the problem did not disappear. Any suggestions?

+6
source share
3 answers

I also had a similar problem. I use codeigniter and get the error "pdo_mysql.so not found" and tried to fix it. I have to search through the first 10 pages of Google search results for several queries. I found a lot of people with the same problems, but for some reason none of them got an answer / fix. Through all this reading, I found out that β€œ PDO and the PDO_SQLITE driver are enabled by default with PHP 5.1.0. ” This made me think: β€œMaybe I need to remove the extension = pdo_mysql. Therefore the pdo.so line from my php.ini ! " I figured php was trying to download an extension that was no longer there, since it is now built-in. Of course, solved all my mess of php errors.

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: August 19, 2014 10:33:30
Cpanel :: Easy :: Apache v3.26.5 rev9999

+1
source

I am sure you are missing the PHP_PDO package. Try to find the PDO package by running the command below:

  # rpm -qa| grep "pdo" 

Mine shows php53u-pdo-5.3.26-1.ius.el5

If you are using php 5.3 try

 # yum install php53u-pdo 
0
source

I don’t know if it’s too late for an answer, but I will send a message if someone finds this error.

First I installed php-pdo on Centos 7 with yum. I looked at phpinfo and it shows the pdo extension, but not pdo-mysql.

So, if you then install php-mysql (yum install php-mysql), it will automatically install the pdo-mysql extension.

0
source

Source: https://habr.com/ru/post/955690/


All Articles