Unable to install pdo_oci on redhat7
Hello everyone.
I'm trying to install pdo_oci on my redhat7 system by following this tutorial http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/, but when I get to the make step, I get the following error that I can't resolve:
php_pdo_oci_int.h:26:2: error: unknown type name 'sb4'
sb4 errcode;
Any assistance would be greatly appreciated.
For your information, I have oracle 12c installed and php 7, and the version of pdo_oci I downloaded is PDO_OCI-1.0.
Thank you in advance for the help.
I'm trying to install pdo_oci on my redhat7 system by following this tutorial http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/, but when I get to the make step, I get the following error that I can't resolve:
php_pdo_oci_int.h:26:2: error: unknown type name 'sb4'
sb4 errcode;
Any assistance would be greatly appreciated.
For your information, I have oracle 12c installed and php 7, and the version of pdo_oci I downloaded is PDO_OCI-1.0.
Thank you in advance for the help.
8 answers
-
Hello,
You are probably missing a header, I imagine you had other errors before this one. In theory, to compile your program you are supposed to run./configure
beforehand to ensure that you have everything you need.
I invite you to first check if under Red Hat you don't have a package that allows you to install directly what you want. You only compile a package on a machine as a last resort (i.e., when there are no packages available). In other words, this tutorial seems quite complicated to me, but maybe you have no choice.
If there is no suitable package, check if you might have missed something by comparing your tutorial with this one:
https://ccm.net/faq/4987-linux-redhat-oracle-installing-pdo-oci-and-oci8-modules
Ideally, you should find the header that provides this type "sb4," but I haven't been able to find it (with such a name, you find a lot of other things on Google), and install the package that provides it.
Good luck. -
Hello mamiemando,
Thank you for the assistance. By the way, I used the method from the link you provided. The installation of oci8 does not show any errors during the installation, but when I use oci_connect to connect to a database, I get the following error: Fatal error: Uncaught Error: Call to undefined function oci_connect().
When I try to install pdo_oci, during the make && make install, I get the following error:
-fPIC -DPIC -o .libs/pdo_oci.o
In file included from /home/oracle/PDO_OCI-1.0/pdo_oci.c:31:0:
/home/oracle/PDO_OCI-1.0/php_pdo_oci_int.h:21:17: fatal error: oci.h: No such file or directory
#include <oci.h>
^
compilation terminated.
make: *** [pdo_oci.lo] Error 1
Thank you in advance for your assistance.</oci.h> -
Hello,
For now, your compilation is going poorly, probably because you haven't installed all the libraries necessary for compilation beforehand.
I can't really reproduce the procedure since I don't use the same distribution, but I suspect that when you run
#ln -s /usr/include/php5/ include/php
... the path was incorrect,
- either because you're not running the command from the right directory
- or because /usr/include/php5 does not contain the oci.h file.
1) Start by locatingoci.h
:find /usr | grep "/oci.h$"
2) In C, when we write <toto.h>, it means that toto.h is in an include directory specified to the compiler. These directories are those explained by the-I
or-isystem
options at compile time.
Under Linux, the directories/usr/include
and/usr/local/include
are implicitly considered (no need for-I/usr/include
therefore).
I suspect that currently, your program is compiled with the-I ./include/php
option, which would explain why the tutorial asks you to make this symbolic link (ln -s /usr/include/php5/ include/php
).
If that's the case, then when you runls ./include/php
from the directory where you are compiling, the fileoci.h
should appear. Otherwise, the symbolic link is wrong. The location ofoci.h
can help us understand if there is an error in your tutorial.
3) You can also use -I/usr/include/php if your file is/usr/include/php/oci.h
.
4) For more details, I would need to see what's inPDO_OCI-1.0.tgz
. If you can share that file, I can take a look.
Good luck -
Hello mamiemando,
here is the content of the PDO_OCI-1.0 directory after extraction:
CREDITS
php_pdo_oci.h
config.w32
oci_driver.c
config.m4
php_pdo_oci_int.h
oci_statement.c
pdo_oci.c
Thank you in advance. -
Hello mamiemande,
1) /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/oci.h
2) when I do ls ./include/php I can see the file oci.h in the list that is displayed as you can see: nzerror.h occiAQ.h occiControl.h occi.h oci1.h ociap.h ocidef.h ocidfn.h oci.h ocixmldb.h oratypes.h ori.h oro.h xa.h
nzt.h occiCommon.h occiData.h occiObjects.h oci8dp.h ociapr.h ocidem.h ociextp.h ocikpr.h odci.h orid.h orl.h ort.h
Thank you for your availability. -
1) So here it is, this is not a standard directory and if you don't specify to the compiler that it might find headers in
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/
, it won't find them...
2) ... but thanks to this symbolic link, it should work, provided it was created from the right directory. Did you runls
in the directory that contains theMakefile
?
If the problem persists, run./configure
again and copy and paste the result for me.
Good luck -
Good evening mamiemando,
When running ./configure in the PDO_OCI-1.0 directory, here is what it displays:
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking Oracle OCI support for PDO... yes, shared
checking Oracle Install-Dir... /u01/app/oracle/product/12.1.0/db_1 :yes:
checking if that is sane... yes
checking Oracle version... 10.1
checking for OCIEnvCreate in -lclntsh... yes
checking for OCIEnvNlsCreate in -lclntsh... yes
checking for OCILobIsTemporary in -lclntsh... yes
checking for OCICollAssign in -lclntsh... yes
checking for OCIStmtFetch2 in -lclntsh... yes
checking for PDO includes... checking for PDO includes... /usr/include/php/ext
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
And now when I run make, here is the error and warnings that appear:
/bin/sh /home/oracle/PDO_OCI-1.0/libtool --mode=compile cc -I -I. -I/home/oracle/PDO_OCI-1.0 -DPHP_ATOM_INC -I/home/oracle/PDO_OCI-1.0/include -I/home/oracle/PDO_OCI-1.0/main -I/home/oracle/PDO_OCI-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/12.1.0/db_1/rdbms/public -I/u01/app/oracle/product/12.1.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /home/oracle/PDO_OCI-1.0/pdo_oci.c -o pdo_oci.lo
libtool: compile: cc -I -I. -I/home/oracle/PDO_OCI-1.0 -DPHP_ATOM_INC -I/home/oracle/PDO_OCI-1.0/include -I/home/oracle/PDO_OCI-1.0/main -I/home/oracle/PDO_OCI-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/12.1.0/db_1/rdbms/public -I/u01/app/oracle/product/12.1.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /home/oracle/PDO_OCI-1.0/pdo_oci.c -fPIC -DPIC -o .libs/pdo_oci.o
/home/oracle/PDO_OCI-1.0/pdo_oci.c:34:1: error: unknown type name 'function_entry'
function_entry pdo_oci_functions[] = {
^
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: braces around scalar initializer [enabled by default]
{NULL, NULL, NULL}
^
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: (near initialization for 'pdo_oci_functions[0]') [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: initialization makes integer from pointer without a cast [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: (near initialization for 'pdo_oci_functions[0]') [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: excess elements in scalar initializer [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: (near initialization for 'pdo_oci_functions[0]') [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: excess elements in scalar initializer [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:35:2: warning: (near initialization for 'pdo_oci_functions[0]') [enabled by default]
/home/oracle/PDO_OCI-1.0/pdo_oci.c:56:2: warning: initialization from incompatible pointer type [enabled by default]
pdo_oci_functions,
^
/home/oracle/PDO_OCI-1.0/pdo_oci.c:56:2: warning: (near initialization for 'pdo_oci_module_entry.functions') [enabled by default]
make: *** [pdo_oci.lo] Error 1
Best regards!
Thank you for your availability. -
Oh, your error message has changed!
Have you tried this?
https://stackoverflow.com/questions/20874536/pdo-oci-make-does-not-work
Good luck