What path to use when installing PHP OCI8 Linux Centos 8

情到浓时终转凉″ 提交于 2020-08-09 08:16:41

问题


I'm having a problem and very confuse at the moment.

I tried to install oracle instant client on my linux centos 8. What I achieved so far is httpd, php72 and mariadb is working fine. I can run my php file in the server.

I am following this tutorial to enable php oci8 in my LAMPP stack.

https://medium.com/@azharnian/cara-install-oci8-php-7-di-centos7-851abbb5d15

But stuck on this step which is

sudo pecl install oci8

Command prompt ask to provide the path to the ORACLE_HOME directory. Refer to the image.

I download and place my oracle-instant-client zip package in my /home/user/oracle

What I tried so far in this step is :

sudo sh -c "echo instantclient, /usr/lib64/php/modules"
sudo sh -c "echo instantclient_19_8, /usr/lib64/php/modules"
sudo sh -c "echo instantclient_19_8, /home/user/oracle/instantclient_19_8"
instantclient_19_8, /usr/lib64/php/modules/oci8.so
instantclient_19_8, /home/user/oracle/instantclient_19_8

Errors :

checking build system type... Invalid configuration `/usr/lib64/php/modules/oci8.so': machine `/usr/lib64/php/modules/oci8.so' not recognized

What exactly this step want me to write ?

Appreciate if someone can show me the right way on this. Many thanks.


回答1:


Download and unzip the Instant Client sdk ZIP file into the same directory /home/user/oracle/instantclient_19_8 so it looks something like:

  /home/user/oracle/instantclient_19_8:
  -r-xr-xr-x@  1 cjones  staff       5780  3 Jul 14:44 BASIC_LICENSE
  -rw-r--r--@  1 cjones  staff       1632  3 Jul 14:44 BASIC_README
  -r-xr-xr-x@  1 cjones  staff       5780  3 Jul 14:44 SDK_LICENSE
  -rw-r--r--@  1 cjones  staff       1626  3 Jul 14:44 SDK_README
  -rwxr-xr-x@  1 cjones  staff      41696  3 Jul 14:44 adrci
  -rwxr-xr-x@  1 cjones  staff      59272  3 Jul 14:44 genezi
  lrwxrwxrwx   1 cjones  staff         17 29 Jul 08:39 libclntsh.so -> libclntsh.so.19.1
  lrwxrwxrwx   1 cjones  staff         17 29 Jul 08:39 libclntsh.so.10.1 -> libclntsh.so.19.1
  lrwxrwxrwx   1 cjones  staff         17 29 Jul 08:39 libclntsh.so.11.1 -> libclntsh.so.19.1
  lrwxrwxrwx   1 cjones  staff         17 29 Jul 08:39 libclntsh.so.12.1 -> libclntsh.so.19.1
  lrwxrwxrwx   1 cjones  staff         17 29 Jul 08:39 libclntsh.so.18.1 -> libclntsh.so.19.1
  -rwxr-xr-x@  1 cjones  staff   80804848  3 Jul 14:44 libclntsh.so.19.1
  -rwxr-xr-x@  1 cjones  staff    8019360  3 Jul 14:44 libclntshcore.so.19.1
  -r-xr-xr-x@  1 cjones  staff    3608240  3 Jul 14:44 libipc1.so
  -r-xr-xr-x@  1 cjones  staff     478096  3 Jul 14:44 libmql1.so
  -rwxr-xr-x@  1 cjones  staff    6586360  3 Jul 14:44 libnnz19.so
  lrwxrwxrwx   1 cjones  staff         15 29 Jul 08:39 libocci.so -> libocci.so.19.1
  lrwxrwxrwx   1 cjones  staff         15 29 Jul 08:39 libocci.so.10.1 -> libocci.so.19.1
  lrwxrwxrwx   1 cjones  staff         15 29 Jul 08:39 libocci.so.11.1 -> libocci.so.19.1
  lrwxrwxrwx   1 cjones  staff         15 29 Jul 08:39 libocci.so.12.1 -> libocci.so.19.1
  lrwxrwxrwx   1 cjones  staff         15 29 Jul 08:39 libocci.so.18.1 -> libocci.so.19.1
  -rwxr-xr-x@  1 cjones  staff    2338456  3 Jul 14:44 libocci.so.19.1
  -rwxr-xr-x@  1 cjones  staff  130527608  3 Jul 14:44 libociei.so
  -r-xr-xr-x@  1 cjones  staff     153600  3 Jul 14:44 libocijdbc19.so
  -rwxr-xr-x@  1 cjones  staff     115760  3 Jul 14:44 liboramysql19.so
  drwxr-xr-x@  3 cjones  staff         96  3 Jul 14:44 network
  -rw-r--r--@  1 cjones  staff    4396157  3 Jul 14:44 ojdbc8.jar
  drwxr-xr-x@  7 cjones  staff        224  3 Jul 14:44 sdk
  -rw-r--r--@  1 cjones  staff    1681792  3 Jul 14:44 ucp.jar
  -rwxr-xr-x@  1 cjones  staff     236256  3 Jul 14:44 uidrvci
  -rw-r--r--@  1 cjones  staff      74263  3 Jul 14:44 xstreams.jar

Then run

sudo sh -c "echo /home/user/oracle/instantclient_19_8 > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig

(as shown in the installation instructions).

Then at the pecl install oci8 prompt enter instantclient,/home/user/oracle/instantclient_19_8. Note I don't use whitespace after the comma. I don't recall what happens if you do use a whitespace. On my typical hack machines I tend to do it all as root:

sudo su -
pecl install oci8

but you can probably do some kind of sudo sh -c option and run echo "instantclient,/home/user/oracle/instantclient_19_8" | pecl install oci8

PS there may be some useful material in https://www.oracle.com/database/technologies/underground-php-oracle-manual.html



来源:https://stackoverflow.com/questions/63125777/what-path-to-use-when-installing-php-oci8-linux-centos-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!