Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting to Oracle 19c from PHP

NuGlamSMSMay 4 2022 — edited May 4 2022

I have a Centos 8 server where I have installed PHP.
Then I installed OCI8 with this final result:
----------------------------------------------------------------------
Libraries have been installed in:
/var/tmp/pear-build-rootwzbyph/oci8-2.2.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:

  • add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
    during execution
  • add LIBDIR to the 'LD_RUN_PATH' environment variable
    during linking
  • use the '-Wl,-rpath -Wl,LIBDIR' linker flag
  • have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0" install
Installing shared extensions: /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr/lib64/php/modules/
running: find "/var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0" | xargs ls -dils
42049960 0 drwxr-xr-x 3 root root 17 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0
20799814 0 drwxr-xr-x 3 root root 19 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr
25928868 0 drwxr-xr-x 3 root root 17 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr/lib64
33561584 0 drwxr-xr-x 3 root root 21 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr/lib64/php
42049964 0 drwxr-xr-x 2 root root 21 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr/lib64/php/modules
42049963 884 -rwxr-xr-x 1 root root 901808 Apr 26 18:40 /var/tmp/pear-build-rootwzbyph/install-oci8-2.2.0/usr/lib64/php/modules/oci8.so

Build process completed successfully
Installing '/usr/lib64/php/modules/oci8.so'
install ok: channel://pecl.php.net/oci8-2.2.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini
---
I added the line extension=oci8.so to the php.ini file.

Now i don't get errors when trying to make a query, but it doesn't return any result.
I have query the phpinfo and I see OCI8 is correctly enable, but I don't see the PDO driver enabled for OCI.
oci8.jpg
pdo.jpgDo I have to install PDO? I have read that OCI8 and PDO are two completely different PHP extensions designed to connect to Oracle databases
In case I have to install PDO, where can I find the instructions to follow for my server version?
This is my php version:
# php --version
PHP Warning: Module 'oci8' already loaded in Unknown on line 0
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Thank you in advance.

Comments

Post Details

Added on May 4 2022
1 comment
7,332 views