user1785900
user1785900

Reputation:

oracle 11 connection with php 5.5

I am trying to make a connection from PHP Version 5.5.27 to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

Downloaded instant client version 11.2.0.3.0 and linked it in system's PATH variable

Also I have enabled extension=php_oci8.dll in my php.ini

but still not working, I get this error:

Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries in C:\xampp\htdocs\test.php on line 3

Upvotes: 2

Views: 661

Answers (1)

AghaKhan
AghaKhan

Reputation: 74

Here is the step-by-step procedure that helped me connecting Oracle with PHP:

  1. First install Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production. Make sure its working.
  2. Download msvcp110.dll and msvcr110.dll (download dll's only. Don't download them from microsoft.com. Download them from some other source instead).
  3. Copy both files directly into Windows/System32 folder.
  4. Restart Computer.
  5. Install WAMP server.
  6. Make sure both Oracle and WAMP Server are installed in same drives. I have them in C:
  7. Check if WAMP is working. (the W logo turns green).
  8. Once its Green, click on it, go on PHP, then to PHP Extensions.
  9. Now check php_oci8.
  10. WAMP will restart its services.
  11. Now from same menu, check php_oci8_11g
  12. WAMP will restart again now.
  13. Restart your computer.
  14. Download 'instantclient-basic-win-x86-64-11.2.0.1.0'
  15. Extract it in C:.
  16. Go to Control Panel > Environment Variable (Search for Environment Variables in control panel)
  17. Under 'Advanced' tab, click Environment Variables.
  18. In System Variables (section below), Click 'New...'
  19. Fill the form; Variable Name: PATH, Variable Value: C:\instantclient_11_2.
  20. Apply Changes.
  21. Restart Computer.
  22. Oracle and PHP are connected.
  23. Make new database in oracle. Notedown the username, password and service name while creating database.
  24. write your SQL script.
  25. Make php file in wamp/www folder
  26. write php script to fetch data from same database you created in oracle.
  27. in php script, write oci_connect('username', 'password', 'localhost/service name').
  28. save php file and run in in browser you specifed while installing WAMP.

Upvotes: 1

Related Questions