Discussions
Categories
- 385.5K All Categories
- 5.1K Data
- 2.5K Big Data Appliance
- 2.5K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Connecting to Oracle 19c from PHP
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.
Do 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.
Answers
-
Installing some web server related stuff under /var/tmp is not a good practice and it may be that in Redhat EL familily of Linux distributions (RHEL, CentOS, Oracle Linux, ...) you may encounter SELinux errors because of the installation directory.