Reputation: 1
He,
I try since several days to install PDO_OCI on PHP7 on a new server. I have ever on other server PDO_OCI but on PHP 5.4, and all is good, not problem with this version.
I have the message :
:/home/pear/download/PDO_OCI-1.0# make
/bin/bash /home/pear/download/PDO_OCI-1.0/libtool --mode=compile cc -I -I.
-I/home/pear/download/PDO_OCI-1.0 -DPHP_ATOM_INC
-I/home/pear/download/PDO_OCI-1.0/include
-I/home/pear/download/PDO_OCI-1.0/main
-I/home/pear/download/PDO_OCI-1.0
-I/usr/include/php/20151012
-I/usr/include/php/20151012/main
-I/usr/include/php/20151012/TSRM
-I/usr/include/php/20151012/Zend
-I/usr/include/php/20151012/ext
-I/usr/include/php/20151012/ext/date/lib
-I/usr/lib/oracle/instantclient/include/oracle/12.1/client -DHAVE_CONFIG_H -g -O2 -c
/home/pear/download/PDO_OCI-1.0/oci_driver.c -o oci_driver.lo
libtool: compile: cc -I -I.
-I/home/pear/download/PDO_OCI-1.0 -DPHP_ATOM_INC
-I/home/pear/download/PDO_OCI-1.0/include
-I/home/pear/download/PDO_OCI-1.0/main
-I/home/pear/download/PDO_OCI-1.0
-I/usr/include/php/20151012
-I/usr/include/php/20151012/main
-I/usr/include/php/20151012/TSRM
-I/usr/include/php/20151012/Zend
-I/usr/include/php/20151012/ext
-I/usr/include/php/20151012/ext/date/lib
-I/usr/lib/oracle/instantclient/include/oracle/12.1/client -DHAVE_CONFIG_H -g -O2 -c
/home/pear/download/PDO_OCI-1.0/oci_driver.c -fPIC -DPIC -o .libs/oci_driver.o
/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'pdo_oci_fetch_error_func':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:51:3: error:
too many arguments to function 'add_next_index_string' add_next_index_string(info, einfo->errmsg, 1);
In file included from /usr/include/php/20151012/main/php.h:39:0,
from /home/pear/download/PDO_OCI-1.0/oci_driver.c:25:
/usr/include/php/20151012/Zend/zend_API.h:432:14: note: declared here
ZEND_API int add_next_index_string(zval *arg, const char *str);
^
/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'oci_handle_preparer':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:238:59: warning: passing argument 5 of 'pdo_parse_params' from incompatible pointer type
ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len TSRMLS_CC);
^
In file included from /home/pear/download/PDO_OCI-1.0/oci_driver.c:29:0:
/usr/include/php/20151012/ext/pdo/php_pdo_driver.h:678:13: note: expected 'size_t *' but argument is of type 'int *'
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len,
^
/home/pear/download/PDO_OCI-1.0/oci_driver.c: At top level:
/home/pear/download/PDO_OCI-1.0/oci_driver.c:411:2: warning: initialization from incompatible pointer type
oci_handle_preparer,
^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:411:2: warning: (near initialization for 'oci_methods.preparer')
/home/pear/download/PDO_OCI-1.0/oci_driver.c:412:2: warning: initialization from incompatible pointer type
oci_handle_doer,
^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:412:2: warning: (near initialization for 'oci_methods.doer')
/home/pear/download/PDO_OCI-1.0/oci_driver.c:413:2: warning: initialization from incompatible pointer type
oci_handle_quoter,
^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:413:2: warning: (near initialization for 'oci_methods.quoter')
Makefile:198: recipe for target 'oci_driver.lo' failed
make: *** [oci_driver.lo] Error 1
My configuration : Linux server System Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 PHP PHP Version 7.0.4-1~dotdeb+8.1 PDO drivers mysql OCI8 Support enabled (is work).
I have read PDO_OCI is include on PHP7 https://github.com/php/php-src/tree/PHP-7.0.7/ext/pdo_oci but how activate it ?
My code to PHP 5.4 doesn't work on this server PHP7.
Somebody have a solution ?
Regards
Upvotes: 0
Views: 17216
Reputation: 41
Download the source files of your PHP (get URL from https://www.php.net/downloads, e.g. https://www.php.net/distributions/php-7.4.16.tar.bz2):
PHP_VERSION=7.3.27 # Set to your PHP version
cd /tmp
sudo apt-get install php-dev -y
wget https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz
tar xvfj php-${PHP_VERSION}.tar.bz2
rm php-${PHP_VERSION}.tar.bz2
Copy pdo_oci
into /tmp
:
cp -r /tmp/php-${PHP_VERSION}/ext/pdo_oci /tmp
cd /tmp/pdo_oci
Build plugin:
sudo phpize
sudo ./configure --enable-option-checking=fatal # Optionally add more parameters
sudo make
sudo make install
Finall, create and link files:
sudo echo "extension=pdo_oci.so" > /etc/php/7.3/mods-available/pdo_oci.ini
sudo ln -s /etc/php/7.3/mods-available/pdo_oci.ini /etc/php/7.3/apache2/conf.d/20-pdo_oci.ini
Restart apache2
Upvotes: 4
Reputation: 42743
This extension has been abandoned and won't compile. Why? PHP's API has changed significantly in version 7; the error you are seeing indicates that internal function signatures have changed:
/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'pdo_oci_fetch_error_func':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:51:3: error:
too many arguments to function 'add_next_index_string' add_next_index_string(info, einfo->errmsg, 1);
How to fix this depends on how you installed PHP. I will hope you compiled it yourself, since you are doing the same for extensions. If so, just recompile using --with-pdo-oci=DIR
where DIR
is the Oracle home directory.
If you installed from a package via apt
, you've got a few choices. 1) see if you can get get a PDO-OCI driver the same way (doesn't look like there is one.) 2) remove your packages and do everything from source. 3) Try a third-party driver.
Upvotes: 0