Sunday, July 19, 2009

Setting up an Oracle an PHP development environment

There are a number of tutorials on setting up php and mysql. And there are awesome projects e.g. WAMP and XAMPP to get you started quickly.

I use Nusphere's PHP ed as my programming tool. It is simply the best php environment (at least about an year back ... when I researched into the options available).

There is also an article explaining the process on OTN:

However as per my observation I did not need to replace the php_oci8.dll . In fact doing so cause my php code to break.

Heres what I did to get it running:
  • Install Nusphere's PHP ed.
  • Modify php.ini (c:\Program Files\NuSphere\PhpED\php5\php.ini) that is formed uncommenting the line : extension=php_oci8.dll
  • Extract the instant client (I tried : from ) to c:\instantclient_10_2
  • Put c:\instantclient_10_2 in your PATH
  • If you are going to use TNSNAMES.ora you can put it in c:\instantclient_10_2 and add a system environment variable TNS_ADMIN and SQL_PATH pointing both to c:\instantclient_10_2
That is it. You are all set.

Say you have an entry in tnsnames.ora as :

RX =
      (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))
      (SID = 69333)

Just put the IP .. e.g HOST=
You can now do a simple connect via:

$conn = @OCILogon($user,$password , "rx") or die ("Database Connection Error in file...");