title: Installing OCI8 with PHP 5.6 on centOs (vagrant)
body: <p>From my understanding, and from previous installations, to install oci8 with php 5.6 on centOs I need to go through the fallowing steps:</p>
  
  <ul>
  <li>Install oracle-instantclient11.2-basic and oracle-instantclient11.2-devel with RPM.</li>
  <li>Install oci8 php extension with pecl.</li>
  <li>Add extension to php.ini.</li>
  </ul>
  
  <p>That's what I did in my provision file.</p>
  
  <pre class="lang-sh prettyprint-override"><code>installOracleInstantClient() {
    # ===================================================================
    # Install Oracle Support for PHP
    # ===================================================================
    if [ $(rpm -qa | grep -c 'oracle-instantclient') -eq 0 ]; then
      printLog 'Installing Oracle Client'
      yum --quiet -y install libaio
  
      yum -y --nogpgcheck --quiet install /opt/packages/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
      yum -y --nogpgcheck --quiet install /opt/packages/oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
  
      cat &gt; /etc/environment &lt;&lt;EOM
  ORACLE_HOME="/usr/lib/oracle/11.2/client64"
  LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client64/lib"
  EOM
  
      cat &gt; /etc/profile.d/oracle.sh &lt;&lt;EOM
  export ORACLE_HOME=/usr/lib/oracle/11.2/client64
  export PATH=$PATH:$ORACLE_HOME/bin
  export LD_LIBRARY_PATH=$ORACLE_HOME/lib
  export TNS_ADMIN=$ORACLE_HOME/network/admin
  EOM
  
      export ORACLE_HOME=/usr/lib/oracle/11.2/client64
      export PATH=$PATH:$ORACLE_HOME/bin
      export LD_LIBRARY_PATH=$ORACLE_HOME/lib
      export TNS_ADMIN=$ORACLE_HOME/network/admin
  
  
      mkdir -p /usr/lib/oracle/11.2/client64/network/admin -p
    fi
  }
  
  installPHP() {
    if [ $(rpm -qa | grep -c 'php') -eq 0 ]; then
      printLog 'Installing PHP'
  
      installGcc;
  
      installEPEL;
  
      installGit;
  
      printLog 'Adding php5.6 repositories'
  
      rpm -Uvh http://vault.centos.org/7.0.1406/extras/x86_64/Packages/epel-release-7-5.noarch.rpm
      rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  
      yum install yum-utils
  
      printLog 'installing php packages'
      yum --enablerepo=remi,remi-php56 install --quiet -y php php-common php-cli php-pear php-pdo php-devel php-ldap php-mbstring php-bcmath php-mysqlnd php-soap php-gd php-xml php-simplexml php-curl php-zip php-oci8 php-ldap php-zip php-fileinfo
  
      # php-mssql php-sqlite php-mcrypt
  
      printLog 'Installing OCI8 extension for PHP'
      printf "instantclient,/usr/lib/oracle/11.2/client64" | pecl install oci8-2.0.12
  
      # bits to add oci to php.ini
      echo 'extension=oci8.so' &gt;&gt; /etc/php.ini
  
      sudo sh -c "echo /usr/lib/oracle/11.2/client64 &gt; /etc/ld.so.conf.d/oracle.conf"
      sudo ldconfig
  
    fi
  }
  
  installOracleInstantClient;
  installPHP;
  </code></pre>
  
  <p>On machine provision I get the following errors:</p>
  
  <pre class="lang-sh prettyprint-override"><code>default: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/oci8.so' - libclntsh.so.18.1: cannot open shared object file: No such file or directory in Unknown on line 0
  
  default: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_oci.so' - libclntsh.so.18.1: cannot open shared object file: No such file or directory in Unknown on line
   0 
  </code></pre>
  
  <p>The same when I ssh into the machine and execute <code>php -v</code>. </p>
  
  <p>Executing <code>ldd -r /usr/lib64/php/modules/oci8.so</code> returns a bunch of <code>Undefined symbol</code> errors and the expected <code>libclntsh.so.18.1 =&gt; not found</code> line.</p>
  
  <p>Also, <code>php -i</code> does not return the OCI8 block that's normally shown when oci8 is properly installed.</p>
  
  <p>Any idea on what am I doing wrong?</p>