Friday, October 8, 2010

Configure Xampp And Database Oracle

Hi, anyone hard to connect your xampp to oracle database? Try to follow this direction. Hopefully success!

1. Download Xampp from here
2. Download Oracle Express from here
  • install je macam base.. next2 je...
3. Download instantclient oracle dan download sqldeveloper.
  • bile da download. unzipkan masuk dlm C:
  • make sure file tu jd path mcm ni C:\instantclient_11_2 (contoh je, kalau lain version. lain la nombor tu nnt)
4. Cari fail php.ini. biasanya klu pakai xampp.. file tu ada kt C:\xampp\php\
  • find perkataan extension=php_oci8.dll
  • ada nmpk ; kt depan perkataan tu kan.. buang ; tu..
  • save.
5. skrg ni set path kt system variable.
  • right click kt my computer.
  • properties

  • advance system setting


  • kt bawah tu ada environment variables.

  • klik kt new tu. pastu 

  • kat variable name tu letak : PATH
  • kat variable value tu letak : C:\instantclient_11_2
  • pastu ok je sume.
6. Copy file C:\instant_client_11_2\oci.dll ke dalam C:\xampp\php\
7. restart atau start xampp service. jangan start untuk mysql (tak pakai pun)
8. try create satu file php yang connect ke database oracle

<?php
// try connecting to the database
$c = oci_connect('username', 'password', 'host');

// check for any errors
if (!$c)
{
 $e = oci_error();
 print htmlentities($e['message']);
 exit;
}
else
{
 echo "database telah berjaya diconnect";
}
 ?>

8. kalau run browser file tersebut. mesti akan keluar perkataan "database telah berjaya diconnect".

9. tahniah. file php skrg sudah boleh menggunakan database oracle.. :-)


No comments:

Post a Comment