安装PHPOCI8LinuxCentos 8时使用什么路径

What path to use when installing PHP OCI8 Linux Centos 8

我遇到了一个问题,现在很困惑。

我尝试在我的 linux centos 8 上安装 oracle instant client。到目前为止我取得的是 httpd,php72 和 mariadb 工作正常。我可以 运行 我的 php 服务器中的文件。

我按照本教程在我的 LAMPP 堆栈中启用 php oci8。

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

但卡在这一步

sudo pecl install oci8

命令提示符询问 provide the path to the ORACLE_HOME directory。参考图片。

我下载 oracle-instant-client 压缩包 并将其放入 /home/user/oracle

到目前为止我在这一步中尝试的是:

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

错误:

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

这一步到底要我写什么?

如果有人能告诉我正确的方法,我将不胜感激。非常感谢。

下载 Instant Client sdk ZIP 文件并将其解压缩到同一目录 /home/user/oracle/instantclient_19_8,使其看起来像:

  /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

然后运行

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

(如图installation instructions).

然后在 pecl install oci8 提示符下输入 instantclient,/home/user/oracle/instantclient_19_8。注意我不在逗号后使用空格。我不记得如果你使用空格会发生什么。在我的典型 hack 机器上,我倾向于以 root 身份完成所有操作:

sudo su -
pecl install oci8

但你或许可以做一些 sudo sh -c 选项和 运行 echo "instantclient,/home/user/oracle/instantclient_19_8" | pecl install oci8

PS https://www.oracle.com/database/technologies/underground-php-oracle-manual.html

中可能有一些有用的 material