问题
I tried all the procedures to install the PHP Oracle client.
1) I installed the Client version 8 and 32 bits.
2) I uncommented oci in php.ini
3) Restarted Wamp:
4) Not sure if really installed but I got the references in php.ini:
5) But still cannot connect:
Tyhanks for any help
EDIT
Found these errors in php log: [16-Apr-2018 14:35:03 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_oci8.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
[16-Apr-2018 14:35:03 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_oci8_11g.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
回答1:
The manual tells you where you've gone wrong:
1) I installed the Client version 8 and 32 bits.
You're using incompatible libraries. The first paragraph of the OCI8 requirements documentation states (emphasis mine):
The OCI8 1.4 extension is included with PHP 5.3, PHP 5.4 and PHP 5.5. It is also available from PECL. A newer OCI8 2.0 version is available only from PECL. OCI8 1.4 requires Oracle 12c, 11g, 10g or 9iR2 client libraries and will install on PHP 4.3.9 onwards. OCI8 2.0 requires Oracle 12c, 11g or 10g client libraries and will install on PHP 5.2 onwards.
2) I uncommented oci in php.ini
Your screenshot shows you've enabled
php_oci8
andphp_oci8_11g
. You should enable only one of the extensions, as stated in the OCI8 installation documentation (again, emphasis mine):When using Oracle 10gR2 client libraries on Windows, uncomment the php.ini line extension=php_oci8.dll. When using Oracle 11gR2 or later client libraries, uncomment extension=php_oci8_11g.dll or extension=php_oci8.dll. With Oracle 12c libraries use extension=php_oci8_12c.dll or extension=php_oci8_11g.dll or extension=php_oci8.dll. Only one of these DLLs may be enabled at a time.
4) Not sure if really installed but I got the references in php.ini:
It's installed and enabled, but not configured correctly. Your screenshots show how PHP was compiled and the various code authors, not anything about your current configuration.
To get the extension working try the following:
- Uninstall and remove all traces of the 'Client version 8'.
- Install Oracle InstantClient 11g or 12c. This typically means simply extracting the .zip file to a folder, e.g.
c:\instantclient_12_1
. - On the InstantClient download page there is a link to the required VC++ runtime on the line after the InstantClient download link. Download and install it.
- Update your
PATH
environment variable to include the location where you extracted the InstantClient files, e.g.c:\instantclient_12_1
. - In
php.ini
enable eitherphp_oci8_11g.dll
orphp_oci8_12c.dll
.
You might need to reboot to ensure the PATH
change is visible to the system.
Be aware that WAMP might include multiple php.ini
files. Make sure to edit the correct one.
来源:https://stackoverflow.com/questions/49859694/what-is-wrong-with-the-installation-of-php-oracle-client-oci8