<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><updated>2009-10-08T13:17:48-05:00</updated><title type="text">Feed for edmann.com</title><link href="http://edmann.com/Computers-Technology/2009/10/08/Oracle-PDO-OCI-PHP-install-fedora-CentOS/feed/atom.xml" rel="self"/><author><name>Edward Mann</name><email>ed.mann@edmann.com</email><uri>http://www.edmann.com/</uri></author><id>urn:uuid:e8f83e34-36cf-3772-a5e5-a286447147f4</id><category term="Computers-Technology"/><subtitle type="text">I should think of something exciting to put here</subtitle><entry><title>Oracle PDO_OCI PHP install fedora CentOS</title><link href="/Computers-Technology/2009/10/08/Oracle-PDO-OCI-PHP-install-fedora-CentOS"/><id>urn:uuid:e9946abe-8cfa-3423-b477-7b3a980699c0</id><updated>2009-10-08T13:09:32-05:00</updated><summary type="html"><![CDATA[<span id="synopsis">Well i run a mix of CentOS and Fedora machines, and at work i needed to run some reports from an Oracle DB. I really don't care much for Oracle, but i needed to get the data, and since i don't like having to do the same thing over again i thought i would just throw together a PHP page and let the user run the canned report themselves. However getting Oracle to install on CentOS and my Fedora boxes was not a simple yum install...</span>]]></summary><category term="Computers &amp; Technology"/><published>2009-10-08T13:17:48-05:00</published><content type="html"><![CDATA[<p><span id="synopsis">Well i run a mix of CentOS and Fedora machines, and at work i needed to run some reports from an Oracle DB. I really don't care much for Oracle, but i needed to get the data, and since i don't like having to do the same thing over again i thought i would just throw together a PHP page and let the user run the canned report themselves. However getting Oracle to install on CentOS and my Fedora boxes was not a simple yum install...</span></p>
<p>So here are my steps on how i got pdo_oci to install on my machine using PHP 5.2.x</p>
<h2><span class="mw-headline">Instant Client</span>&nbsp;</h2>
<p>You will first need to download the instant client from <a rel="nofollow" title="http://www.oracle.com/technology/software/tech/oci/instantclient/index.html" class="external text" href="http://www.oracle.com/technology/software/tech/oci/instantclient/index.html">oracle website</a>. I&nbsp;am using that link because you may have a x86_64 machine or just a x86. That page will let you choose. You will need to install the following packages</p>
<ol>
    <li>oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm</li>
    <li>oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm</li>
</ol>
<p>Run yum -y --nogpgcheck install oracle-instantclient*&nbsp; to install the packages. You can now go to the next section</p>
<h2>Oracle Profile</h2>
<p>Run the following command to create oracle.sh profile in profile.d directory</p>
<pre><code>cat &lt;&lt;EOF &gt; /etc/profile.d/oracle.sh<br /><br />export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib/<br />export     ORACLE_HOME=/usr/lib/oracle/11.2/client/lib/<br />EOF</code>
</pre>
<p>Then run</p>
<p><code>[root@ed-mann]# source /etc/profile.d/oracle.sh</code></p>
<h3 style="color: Red;">Note:</h3>
<p>I did change my ORACLE_HOME to /usr/include/oracle/11.2/client. I am not sure if it did anything, i am planning on testing without doing that.</p>
<h2><span class="mw-headline">PDO_OCI SRC</span></h2>
<p>&nbsp;</p>
<p>To get the oracle PDO&nbsp;driver install on Linux you will need to get the src from pecl</p>
<pre><code>[root@ed-mann tmp]# pecl download pdo_oci</code></pre>
<h2><span class="mw-headline">Patch  </span></h2>
<p>&nbsp;</p>
<p>Then once you have it you need to edit the config.m4 file and add the following after exploding the src look for similar sections</p>
<pre><code>elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.11.2; then<br />PDO_OCI_VERSION=11.2</code></pre>
<p>also add the following</p>
<pre><code>11.2)<br />      PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)<br />    &nbsp;;;</code>
</pre>
<p>Again look for a similar area and add that. I may provide a patch. I did see a patch <a href="http://bugs.php.net/bug.php?id=39312">here</a>.&nbsp;But it did not work for me... well it probably would have but by the time i figured this all out i was not using that patch.</p>
<h2>Compile</h2>
<p>Now you can run phpize and then this configure command</p>
<pre><code>./configure  --with-pdo-oci=instantclient,/usr,11.2</code>
</pre>
<p>Since we are using the instantclient we need to put that also we add what version we are using.</p>
<p>Now you can run make &amp;&amp;&nbsp;&nbsp;make install as root</p>
<h2>Include File</h2>
<p>Create a new file in /etc/php.d named pdo_oci.ini and include the following</p>
<pre><code>; Enable pdo_oci (oracle) extension module<br />extension=pdo_oci.so</code>
</pre>
<h2>Final Steps</h2>
<p>Now you will need to reload/restart Apache. Put phpinfo(); in a page view it from your browser. You should see PDO_OCI listed if not i don't know what went wrong. Leave me a message and i will help if i can.</p>]]></content></entry></feed>
