Building a PHP RPM with the OCI PDO Driver on CentOS

If you are reading this post then you are either curious about what it’s about, you are investigating using PHP + Oracle on CentOS and building your own PHP RPM, or you’re familiar with the your RPM install complaining about This post should hopefully help you out.

Oracle Instant Client RPM

The first thing to note is that the RPM’s that Oracle supply will work fine when building PHP and setting the –with-pdo-oci=instantclient,/usr/,11.2 flag. But as soon as you try to install PHP and it brings in the Instant Client dependency, or if it is already installed you will see the following error:


You may well, like me, spend hours investigating why this occurs especially when

  • I can see the file is installed
  • I’ve symlinked it everywhere I could think of
  • Specified a custom ld.conf.d config with the location of the .so
  • I’ve installed the basic, devel and sdk versions of instant client

So you’ll be pleased to know that it isn’t your fault at all! The Oracle-built RPMs done support the “provides” arugment. Meaning that the file may well be on the filesystem, but if the instant client RPM doesn’t explicity declare that it provided this file then you will have dependency issues. Thanks to this CentOS forum for helping me! So the solution is to rebuild the Oracle instant client libraries yourself or find another reputable source. I used this RPM: you should notice that the “Provides” sections correctly list

Building PHP

Now that you have an RPM that works, you can move on to building PHP! All you need to do is set the –with–pdo-oci flag.

./configure --with-pdo-oci=instantclient,/usr/,11.2

Bish bash bosh!

That should be you all sorted :). Hopefully this was useful to you, I pulled my hair out for several days trying to get to the bottom of it. Thankfully it’s all grown back now!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s