How To Install Oci8 Php

Active3 years, 10 months ago
  1. How To Install Php Oci8
  2. Php Oci8 Connect

According to this (Installing OCI8 from PECL, automated), all I have to do is type in pecl oci8 install.

I don't have a oracle database installed in my system. But i want to connect to the remote system. Do i just need to install oci8 extension library or i need to install both instantclient and the o. I want to share some information about my OCI8 installation to access Oracle databases. If you got errors like 'PHP Startup: Unable to load dynamic library 'oci8.so' or 'checking Oracle Instant.

Use 'pecl install oci8-1.4.10' to install for PHP 4.3.9 - PHP 5.1. The OCI8 extension can be linked with Oracle client libraries from Oracle Database 12, 11, or 10.2.

But that only gets me the following error, repeatedly.

No releases available for package pecl.php.net/oci8.

Another website suggested that I try pear install pecl/oci8. Same error happens.

What do I do to fix this?

zack_falconInstallzack_falcon
1,65814 gold badges45 silver badges86 bronze badges

1 Answer

I have the same error on Ubuntu LTS 14.04:

Finally the reason is the Proxy problem: my computer is sitting after the company proxy server. Run the following command to add the proxy

Then run the command again, it works as bellow

Here we type in the Oracle Instant client folder as bellow:

Then the command line continue ouputs:

Good luck.

AmosAmos
Php
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged phplinuxoci8 or ask your own question.

19 Feb 2018CPOL

Introduction

In response to my extremely (thousands of hits) popular article Installing OCI8 on RHEL, I decided to add this article since I find those instructions have become somewhat out of date, and also it is recommended to use PHP 7.2 with any web application that you are currently supporting. PHP 7.2 provides significant performance improvements over PHP 7.0, so if you are using PHP 7.0, I highly recommend updating to PHP 7.2.

Stopping Apache

You’ll need to stop Apache (web server) using the following command. In any Linux commands I show in this article, it presumes you aren’t logged in as the root user, so you will need to use sudo to issue privileged commands.

Add EPEL & Remi Repositories

You’ll need to install the EPEL & Remi repositories as follows:

Set Config Manager for PHP 7.2

You’ll need to get the yum-utils to use the yum-config-manager to set the default repository using the following commands:

The above enables the Remi PHP 7.2 repository.

Installing PHP 7.2

If you already have PHP 5.x or PHP 7.0 installed, you will need to figure out how to remove it. I used this command to remove php70u from my system(s):

Oci8

You can then check to see if you still have php installed with this command:

You shouldn’t see anything related to php installed, otherwise uninstall the package.

Then you can install PHP 7.2; in my scenario, I normally develop Symfony applications that use PHP in Apache. In my case, I would use the following command to install:

This installs all the packages I need.

Installing OCI8

This is the part that could get tricky. You should be able to issue the following at this point:

Then you’ll need to edit the php.ini file as follows:

Which is the typical location of the php.ini file. In Symfony, look at the “View phpinof()” link, and then look for the “Loaded Configuration File”, which shows the file you need to edit. Then at the bottom of this file, add this line:

Then in vi, issue the command “:wq!” to save the file and quit. Then to check if php is installed correctly, issue this command:

If you see errors like unable to load dynamic link library oci8.so, then you probably need to reinstall Oracle Instant Client or you haven’t installed it.

Installing Oracle Instant Client

You need to download for your Linux client, for example, the following 2 files:

Make sure they are in your home directory, then install with the following commands:

Then, issue the following command to verify PHP is installed correctly:

How To Install Php Oci8

You should see no error and version PHP 7.2 shown.

Verifying OCI8 & PHP 7.2 on Web Server

You’ll need to restart your Apache web server:

Then in Symfony, look at the “View phpinfo()” link. Or create your own using this code:

Then search on the page for the string “oci8”, you should see something like the following image:

Php Oci8 Connect