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 libclntsh.so.11.1. 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: http://rpm.pbone.net/index.php3/stat/4/idpl/23447083/dir/centos_6/com/oracle-instantclient-22.214.171.124.0-11.2.x86_64.rpm.html you should notice that the “Provides” sections correctly list libclntsh.so.
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.
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!