I have to upgrade an old running and functional app that uses PHP 5.3 32bit, Apache2.2 32bit, Oracle client 11.2 32bit running on Windows 64bit (Win10 for dev, and server for prod).
The new stack is Apache2.4 32bit, PHP8 32bit and the exact same Oracle client 11.2 32bit.
And when I run the webapp, I've got this error at the first DB connection attempt :
Fatal error: Uncaught Error: Call to undefined function oci_connect() in c:\some\path\connexion_check.php:16 Stack trace: #0 {main} thrown in c:\some\path\connexion_check.php on line 16
My installation was done using these packages :
- httpd-2.4.48-win32-VS16.zip
- php-8.0.8-Win32-vs16-x86.zip
- php_oci8-3.0.1-8.0-ts-vs16-x86.zip
- php-debug-pack-8.0.8-Win32-vs16-x86.zip
In my PHP.ini file, I have set
extension_dir = "ext"
extension=oci8_11g
There, I use the same parameter as with PHP5.3 => extension=oci8_11g but the DLL was updated with the package php_oci8-3.0.1-8.0-ts-vs16-x86.zip
Running the command php --ri oci8 says
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 3.0.1
Oracle Run-time Client Library Version => 11.2.0.3.0
Oracle Compile-time Instant Client Version => 11.2
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
Some PHPINFO (from CLI)
phpinfo()
PHP Version => 8.0.8
System => Windows NT D20899 10.0 build 19042 (Windows 10) i586
Build Date => Jun 29 2021 15:54:30
Build System => Microsoft Windows Server 2019 Datacenter [10.0.17763]
Compiler => Visual C++ 2019
Architecture => x86
Configure Command => cscript /nologo /e:jscript configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=..\..\..\..\instantclient\sdk,shared" "--with-oci8-19=..\..\..\..\instantclient\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path =>
Loaded Configuration File => C:\www\php8\php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20200930
PHP Extension => 20200930
Zend Extension => 420200930
Zend Extension Build => API420200930,TS,VS16
PHP Extension Build => API20200930,TS,VS16
Debug Build => no
Thread Safety => enabled
Thread API => Windows Threads
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
Registered Stream Socket Transports => tcp, udp, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters => convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk, zlib.*, bzip2.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.0.8, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
Besides this webapp, I manage/use other apps/tools that connect to my Oracle DB using that same InstantClient installation. DB connections are ok from this computer using :
- Oracle tools
- Powerbuilder 32bit
- Python 32bit + cx_Oracle
- Microsoft Word through Oracle Data Provider for .NET and OLEDB
I've checked a lot of things but can't figure out what's wrong. Thanks for your help :-)
Edited :
C:\www\php8>php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mysqlnd
oci8
openssl
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
Xdebug
Hell, I got it. Here's the explanation for the next guy who'll come with the same problem...
Here's some data about my settings :
it seemed odd that the extension oci8 didn't come out from phpinfo(). Using Process Monitor i figured out that oci8_11g.dll was searched everywhere (according to PATH env. variable) but not at the right place.
My setting in PHP.INI was this :
and ProcMon showed that C:\WWW\PHP8\ext was NOT searched into, but rather C:\WWW\Apache24\ext.
Thus I understood that the folder .\ext was relative to the Apache httpd.exe process running from C:\WWW\Apache24\bin
So, in my PHP.ini file I changed my value to a absolute path so that it will be compatible in the CLI environnement as well as PHP launched from Apache.
After restarting the Apache service, all is fine.