Install or enable phps oci8 extension
I have Windows XP and recently I installed wamp (apache-mysql-php) 32-bit. I tested the installation (connect to mysql database with php and apache) and everything was working fine. Now i need to connect to an Oracle database so I tried to enable some extensions related to Oracle and oci8. And I did: 1) I opened php.ini file and I removed the semicolons before the following lines: before:
after:
2) I restarted apache and all Services and i get a
3) In php_error.log file I get:
So, i thought that it would be a good idea to check where my extension php folder is and if those dll files are there. In php.ini my extension folder is located at:
The folder exists and both of these libraries (php_oci8.dll php_oci8_11g.dll) are inside that folder. 4) I added in my 'Path' system variable in Windows the following:
5) I copied both of these dll files in Apache's folder but again it didn't work!
6) Also, I checked the phpinfo page and the only entry I get for "oci8" is the following: Configure Command
Hm...the following folders do not exist in my system:
So, what am I supposed to do next in order to correctly enable the oci8 extensions? thanks 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: phpinfo() System => Windows NT 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. This should now give you information about the current registered php extensions. This list should include the OCI8 extension: [PHP Modules] [Zend Modules] 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 OCI8 Support => enabled Now, php has been correctly configured with the OCI8 extension. How to enable OCI8 in PHP Windows?1 Answer. Download instantclient and place "C:\instantclient_11_2". Set environment variable for C:\instantclient_11_2.. Check your php version i.e. PHP Version 5.6.15.. Un-Comment "extension=php_oci8_11g.dll" in php.ini and restart apache.. check php_info(), oci8 should be enabled. Thats all.. What is OCI8 PHP?OCI8 Functions. oci_bind_array_by_name — Binds a PHP array to an Oracle PL/SQL array parameter. oci_bind_by_name — Binds a PHP variable to an Oracle placeholder.
How can I check my OCI8 status?2) Run the command "php -m" (without the quotes). 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.
|