4

This problem is complicated, and I'm not an expert at all, so bear with me. My server admin team set me up with a standard RHEL box. It had PHP preinstalled, as well as apache.

I am now trying to get Drupal 7 installed on the machine, which has alerted me to a problem:

Database support Disabled

Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that Drupal supports.

Googling this subject and talking to our server guys, it appeared that we needed to enable the PDO extensions in the php.ini file. Great, in /etc/php.ini I added the extension=pdo.so and extension=mysql_pdo.so lines.

Nothing changed, and I've got several concerns. When we search the server for a pdo.so file, it's found in a modules directory deep inside of /usr/ somewhere. We copied the path to that directory into the php.ini as extension_dir=[that path]. Restart apache, no change.

When I run php -version, I see an error message that says it can't load the dynamic library, but it's looking for the pdo.so library in /usr/local/lib/php/extensions/some-strange-no-debug-non-zts-0330i504065/ directory. Not in the directory we just set as "extensions_dir" in the php.ini. And in the phpinfo() output, it lists the extension directory like we set it in php.ini.

Second, in phpinfo() output, in the "Configure Command" section, the --disable-pdo flag is present.

If I check which php, and then navigate there, there's another file in that directory called php-config. Open that up, and TA DA! There's an "extension_dir" value that matches the /some-strange-no-debug-non-zts-92ur9u92i/ directory that was mentioned before.

Does this all need to be recompiled with the appropriate flags? Can it be fixed in php.ini? If not, how would we even go about recompiling php if it was installed with yum or rpm?

THANKS!!!

UPDATE 1
I should say, I'm using RHEL5 php53 packages. I have already run yum install php53-pdo. If I try to run yum install php-pdo (or any other non php53 php package) I get conflict errors between php53-common and php-common, which is why I started running php53 packages in the first place.

4
  • rpm -qa | grep php? yum repolist or ls /etc/yum.repos.d?
    – quanta
    Oct 14, 2011 at 2:55
  • It depends. Are you on red hat 5 or 6?
    – Rilindo
    Oct 14, 2011 at 3:46
  • @quanta neither of those commands work (no such file or directory) Oct 14, 2011 at 11:48
  • @Rilindo RHEL5, Oracle build though if that makes a difference. Oct 14, 2011 at 11:50

3 Answers 3

3

Assuming you're using the RHEL5 php53 packages:

# yum install php53-pdo

If you're still using the default RHEL5 PHP 5.1 RPMs then you first uninstall them all, then install everything in the php53 chain that you think you'll need.

# yum search php53

However, the RHEL php 5.3 RPMs do not support either PEAR or PECL. They're also missing some other php extensions that are available with the older RPMs. If you need any of those packages you either get to install them yourself (from source), find another repo you think you can trust, or bite the bullet and go to RHEL6. If you go with RHEL's php53 package chain, you'll absolutely want to test all of your code still works. The testing overhead may actually make it easier to go with RHEL6.

4
  • Your assumption is correct. Strangely, we have the php53-pdo package installed and up to date, but Drupal still says we have no PDO libraries available. It makes me think it's related to the --disable-pdo flag in the php configuration, but again, I'm not sure if it's easy to reconfigure and recompile php when you've installed it with yum. So you're saying that upgrading to RHEL6 would solve this? Are there more php53 packages in RHEL6, or is it just php again there? Thanks for your help. Oct 14, 2011 at 11:28
  • Did you restart Apache after installing php53-pdo? The --disable-pdo flag don't prove anything, it's default when installing php from binary package.
    – quanta
    Oct 14, 2011 at 13:08
  • One trick is that you have to uninstall all of the php5.1 RPMs. If you somehow have a mix of both, you can confuse yourself. You'll also want to make sure you have the right additional package for your backend database. (php53-mysql, for example) Having done both, you need to make sure your php.ini is set correctly and the pdo.ini and php_DATABASE.ini are in /etc/php.d
    – M. Ellis
    Oct 14, 2011 at 16:12
  • Turns out, it was the php5.1 RPMs that were causing the issue. Two builds of PHP, weird conflicts and overlaps, nothing worked right. We removed them all and recompiled PHP, went with 5.3.3 because that's working on other servers (5.3.8 probably would have worked too but 3.3 is fine for now). Problems went away! Thanks. Oct 14, 2011 at 17:38
1

You can do this to enable pdo :

yum install php-pdo
0

Depend on which database you're using (MySQL, PostgreSQL,...), make sure that you've enabled the corresponding extension pdo_mysql.so, pdo_pgsql.so. Don't forget to restart the Apache.

$ php -i | grep pdo
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_odbc.ini,
/etc/php.d/pdo_pgsql.ini,
/etc/php.d/pdo_sqlite.ini,
pdo_mysql
pdo_pgsql
Revision =>  $Id: pdo_pgsql.c 300351 2010-06-10 12:11:19Z iliaa $ 
pdo_sqlite

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .