Getting PDO-OCI to work in PHP 7

  49181
May 28, 2019 20:31 php-db@lists.php.net ("Stokes, John M via php-db")
I have made multiple attempts to get PDO-OCI to work in PHP 7. Sometimes it
fails to compile at all, other times appears to compile correctly, but I
can't connect to any Oracle databases. Thus far, this has kept me stuck on
PHP 5.x.

The relevant part of my configure statement is:
../configure \
....
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-mysql=/usr \
--with-pdo-odbc=unixODBC,/usr \
--with-pdo-oci=instantclient,/usr/lib/oracle/18.3/client64/lib/ \
--with-unixODBC=/usr \
....

The latest error is when I run "make":
....snip...
In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:30:0,
                 from main/internal_functions.c:50:
/usr/include/oracle/18.3/client64/ldap.h:988:18: error: conflicting types
for ‘ber_scanf’
 LDAPFUNCDECL int ber_scanf ( BerElement *ber, char * fmt, ... );
                  ^
In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:27:0,
                 from main/internal_functions.c:50:
/usr/include/lber.h:335:1: note: previous declaration of ‘ber_scanf’ was
here
 ber_scanf LDAP_P((
 ^
make: *** [main/internal_functions.lo] Error 1

Can anyone offer me some ideas?
Thanks in advance.

-John

--

John Stokes – Certified Oracle of Security seeking Zend wearing a Red Hat.
(CISSP, ZCE, RHCSA)
Software Engineer
Verizon Wireless - West Territory Data Tools & Reporting

*Three Pillars: Humility, Communication, Balance*
  49182
May 28, 2019 22:48 christopher.jones@oracle.com
Possibly try a two stage build:

- build your main PHP without PDO_OCI

- build PDO_OCI as a shared library with a simplified configure command that doesn't have ldap.

Then move the resulting PDO_OCI library to your first PHP install and update php.ini.

Then test thoroughly.

I have had to do the same with PHP OCI8 in the past.  I don't recall trying it with PDO_OCI.

The ldap / Oracle Client header clash isn't new in PHP 7.

Chris

On 29/5/19 6:31 am, Stokes, John M via php-db wrote:
> I have made multiple attempts to get PDO-OCI to work in PHP 7. Sometimes it > fails to compile at all, other times appears to compile correctly, but I > can't connect to any Oracle databases. Thus far, this has kept me stuck on > PHP 5.x. > > The relevant part of my configure statement is: > ./configure \ > ... > --with-mysqli=/usr/bin/mysql_config \ > --with-pdo-mysql=/usr \ > --with-pdo-odbc=unixODBC,/usr \ > --with-pdo-oci=instantclient,/usr/lib/oracle/18.3/client64/lib/ \ > --with-unixODBC=/usr \ > ... > > The latest error is when I run "make": > ...snip... > In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:30:0, > from main/internal_functions.c:50: > /usr/include/oracle/18.3/client64/ldap.h:988:18: error: conflicting types > for ‘ber_scanf’ > LDAPFUNCDECL int ber_scanf ( BerElement *ber, char * fmt, ... ); > ^ > In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:27:0, > from main/internal_functions.c:50: > /usr/include/lber.h:335:1: note: previous declaration of ‘ber_scanf’ was > here > ber_scanf LDAP_P(( > ^ > make: *** [main/internal_functions.lo] Error 1 > > Can anyone offer me some ideas? > Thanks in advance. > > -John > > -- > > John Stokes – Certified Oracle of Security seeking Zend wearing a Red Hat. > (CISSP, ZCE, RHCSA) > Software Engineer > Verizon Wireless - West Territory Data Tools & Reporting > > *Three Pillars: Humility, Communication, Balance* >