For a CA SAM connector to communicate with an Oracle database, php needs to be configured to use the OCI8 extension.This document should help to get this working as there are a few places where this can go wrong and not give any errors which reveal what the problem is.
To configure php to use the OCI8 extension, you need to ensure that a few conditions are met:
1) The OCI8 extension needs to be able to locate the correct DLLs in order for it to run. This means that the appropriate Oracle Instant Client is installed and the installation folder for the Oracle Instant Client is present in the PATH variable.
First of all, in a command prompt window, change working directory to the CA SAM php folder. Now, run the command "php -i". This should give you information about the current php configuration. At the top, it should look like this:
PHP Version => 7.0.25
System => Windows NT <hostname> 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) i586
Build Date => Oct 24 2017 13:50:48
Compiler => MSVC14 (Visual C++ 2015)
Architecture => x86
You need to download the Oracle Instant client that matches the version of the Oracle database you are using (we'll use Oracle 12c in this example) and that also matches the architecture of the installed version of php. This means that in this case, we need to download the 32 bit version of the Oracle Instant Client for Oracle 12c. Once downloaded, this is extracted to a folder, C:\instantclient_12_2.
Now, modify the PATH variable and add the C:\instantclient_12_2 folder at the beginning of the PATH variable. Placing it at the beginning will ensure that the correct OCI8 DLLs will be found when php calls the OCI8 extension, in case there are other DLLs which may cause problems, present on the system.
2) The extension needs to be enabled in the php.ini file.
Edit the php.ini file and locate this line:
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
Remove the ; character from the start of this line and save this change.
3) The extension DLL is available in the php "extension_dir" location.
In the php.ini file, there is a directive "extension_dir". This should point to the "\sam\env\php\ext" folder. Check this folder to verify that the php_oci8_12c.dll file is present.
Now that all of the pre-requisite work has been done, we need to test if the OCI8 extension is correctly registered with php and that it works:
1) In a command prompt window, change working directory to the CA SAM php folder.
2) Run the command "php -m" (without the quotes).
This should now give you information about the current registered php extensions. This list should include the OCI8 extension:
If this list doesn't include the OCI8 extension, and all of the previous steps have been carried out correctly, this means that there is a problem running the OCI8 extension. To check this, run the "php -i" command. If there are any problems running the extension, it should generate a pop-up window with the reason for the failure. The most common one is a problem with a required DLL, like this:
"The program can't start because MSVCR120.dll is missing from your computer. Try reinstalling the program to fix this problem."
In this case, the system needed the "Visual C++ Redistributable Packages for Visual Studio 2013" to be downloaded and installed. Once this was done, when the "php -i" command was run, there were no pop-up errors, and the output included the OCI8 information:
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.8
Revision => $Id: 8a26cf66ca0f9556b6376408c8f71ead69bdbcbf $
Oracle Run-time Client Library Version => 184.108.40.206.0
Oracle Compile-time Instant Client Version => 12.1
Now, php has been correctly configured with the OCI8 extension.