1

I am running PHP 7.2 and am trying to install oci8

pecl install oci8 results in a download but it fails when running phpize with the following message:

running: phpize
Can't find PHP headers in /opt/remi/php72/root/usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize' failed

Howver, if I try to install php-devel I get a message that it is already installed:

Package php-devel-5.4.45-17.el7.remi.x86_64 already installed and latest version
Nothing to do

I have tried several options but cannot get phpize to work. Any help appreciated.

Thanks

UPDATE

  • I did a fresh install of php 7.3 using remi. This installed the php.ini file into the /etc directory
  • I installed php73-php-oci8
  • I confirmed the php version and module in phpinfo()

With regards Oracle Instant Client, I am not entirely sure what I am doing so here is what I did:

  • cd /etc/yum.repos.d
  • (a few steps to get packages)
  • sudo yum install oracle-instantclient18.3-basic
  • sudo yum install oracle-instantclient18.3-devel
  • sudo yum install oracle-instantclient18.3-jdbc
  • sudo yum install oracle-instantclient18.3-sqlplus
  • sudo yum list oracle-instantclient* ... this confirms the installs

This is as far as I can get. I am not sure how to "include it in the library path". I am not clear on the next step. Please advise

Thank you

DrBorrow
  • 950
  • 12
  • 24

1 Answers1

3

As you are using the php72 SCL, you need the php72-php-devel package.

But, why do you want to build from sources, when nearly all extensions are available ?

yum install php72-php-oci8

Notice: this package requires the oracle client v18.3 installed, and in the library path.

P.S. indeed, the error message probably need to be fixed.

Remi Collet
  • 6,198
  • 1
  • 20
  • 25
  • Thanks Remi. I followed your instructions and - to my surprise - the system says it is installed. I also see that oracle client v19.3 is installed but despite this if I run function_exists('oci_connect') it is not installed. I have been trying for over a week to connect my php to an oracle database with no luck. Can you direct me to a useful guide or give me some guidance on what to test. I think the php setup must be wrong in my server (it was set up by somebody else). Surely it cannot be this hard to connect to Oracle? Any help appreciated – DrBorrow Jun 15 '19 at 09:25
  • @DrBorrow as your question changed surprisingly (but now you revealed the secret;) it may better fit to [dba.se] or [su]. As you still hide your steps that you tried so far I provide general sources for connection oracle with php. First is from php-docs [oci8.installation](https://www.php.net/manual/en/oci8.installation.php), second from oracle [connect-php-72-to-oracle-database-12c-using-oracle-linux-yum-server](https://blogs.oracle.com/linux/connect-php-72-to-oracle-database-12c-using-oracle-linux-yum-server) – ComputerVersteher Jun 16 '19 at 05:15
  • 1
    As I said, for now, oci8 uses oracle v18.3 NOT 19.3 (which will be used in a near future) – Remi Collet Jun 16 '19 at 05:20
  • Thanks Remi - I have tried to follow your guidance. Please see update in the question. I think I am almost there. – DrBorrow Jun 16 '19 at 07:30
  • @RemiCollet you may have seen this, but if not, note the IC 19.3 package changes: https://blogs.oracle.com/opal/oracle-instant-client-19c-for-linux-is-available – Christopher Jones Jun 16 '19 at 11:59
  • @DrBorrow when in doubt, read the [Instant Client installation instructions](https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst) which show how to run ldconfig to "include it in the library path" (Note this step won't be needed for IC 19.3) – Christopher Jones Jun 16 '19 at 12:05
  • WOOOHOO! It is working! Thank you @RemiCollet and ChristopherJones For anybody following this question, the final step was 'sudo sh -c "echo /opt/oracle/instantclient_18_3 > /etc/ld.so.conf.d/oracle-instantclient.conf"' – DrBorrow Jun 16 '19 at 20:25
  • @ChristopherJones indeed, I'm aware of the need to update to 19.3, which I plan soon. – Remi Collet Jun 17 '19 at 04:24