Showing posts with label XAMPP. Show all posts
Showing posts with label XAMPP. Show all posts

Enable eAccelerator delivered with XAMPP

How do I activate the eaccelerator in XAMPP?

Solution:

Open the “php.ini” file in the directory \xampp\apache\bin\php.ini. & for Linux: /opt/lampp/etc/php.ini
Here activate the following lines by removing the semicolon in each line in the [eAccelerator] section:

extension=eaccelerator.dll
eaccelerator.shm_size = “0″
eaccelerator.cache_dir = “\xampp\tmp”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″

After that, restart the Apache HTTPD!

Xampp & Oracle

Step by Step procedure to Configure Xampp & Oracle 9i

Install Oracle9i on a Remote Server (Installation of oracle 9i)
Install XAMPP for windows version 1.6.8 (Installation of Xampp for windows is discussed here)
Install Oracle Client 10g

Using oci module for connecting PHP & Oracle
Edit php.ini file, the path to this file is shown in phpinfo page under Loaded Configuration File
Uncomment the line shown below..

;extension=php_oci8.dll
(just remove the semicolon to uncomment the line)
Save the file
Restart Apache Tomcat
Check the phpinfo page, If all goes good u should be able to see the oci details under OCI8

Connect to your database using the php code as shown below

// try connecting to the database
$conn = oci_connect(’scott’,

‘tiger’,'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.136.7.8)(PORT=1521))

(CONNECT_DATA=(SERVER=DEDICATED) (SERVICE_NAME = oracle9.itiltd.com)))’);
// check for any errors
if (!$conn)
{
$e = oci_error();
print htmlentities($e['message']);
exit;
}

// else there weren’t any errors
else
{
echo ‘Connection To Oracle DB Success.’;
}

?>

REMARKS: I’ve tried erlier with Oracle Client 9i. It didn’t workout & was showing error as unable to find php_oci.dll in apache error logs, so i switched to Oracle Client 10g & its working fine.

Oracle Database Connection Strings in PHP

Oracle Database Connection Strings in PHP

It’s easy to get confused as to how to specificy your Oracle database connection string, and there’s a handy new feature in Oracle 10g that makes this a whole lot easier. So here’s a little rundown of the three ways to connect to Oracle databases. You can use the:

  • tnsnames.ora file
  • Full connection string
  • Easy connect string

These examples show how to specificy an Oracle connection string using the new OCI8 functions in PHP.

tnsnames.ora File

The tnsnames.ora file is a client side file that maps an alias used by client programs to a database service. It is used to connect to a non-default database. Here you have to have an entry in the tnsnames.ora file, and reference the alias to that entry in your connection code.

PHP code:

oci_connect($un, $pw, 'MYDB');

tnsnames.ora entry

MYDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = mymachine.mydomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MYDB.AU.ORACLE.COM)) )

Full Connection String

The full connection string does not require the use of a tnsnames.ora file. You need to enter the full connection string when you connect to the database in your code.

PHP code:

oci_connect($un, $pw, '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mymachine.mydomain)(PORT=1521)) (CONNECT_DATA=(SERVER=DEDICATED) (SERVICE_NAME = MYDB)))');

Easy Connect String

This is one Oracle 10g feature that I use daily. As I constantly connect to so many different databases in my day, this has saved me so much time as I don’t have to configure anything, just know the machine name and the database alias and I’m off.

The easy connect string does not require the use of a tnsnames.ora file, and is an abbreviated version of the full connection string. you must have the Oracle 10g client-side libraries to use the easy connect string.

PHP code:

oci_connect($un, $pw, '//mymachine.mydomain:port/MYDB');

----

REMARKS: I'm using Full COnnection Strings method for HOST=mymachine.mydomain i've wrote Oracle Server IP Addres. Path of tnsnames.ora is DRIVE:\oracle9\network\admin\tnsnames.ora

Reference: alisonatoracle blog