Monday, October 26, 2009

Database Connectivity + PHP

There is lot of database option avail for integrate into PHP.You should need to configure at the php.ini file according to your database selection before doing the connectivity. example,

For Mysql
extension=php_mysql.dll

For Microsft Sql Server
extension=php_mssql.dll

For Postgre Sql
extension=php_pgsql.dll

Connectivity

1. MySql
define("HOST","localhost");
define("USER","venkat");
define("PASSWD","xxxx");
define("DATABASE","pos");
function myConn()
{
$db=mysql_connect(HOST,USER,PASSWD);
mysql_select_db(DATABASE,$db);
return $db;
}

2. MS Sql
define("HOST","localhost");
define("USER","venkat");
define("PASSWD","xxxx");
define("DATABASE","pos");
function myConn()
{
$db=mssql_connect(HOST,USER,PASSWD);
mssql_select_db(DATABASE,$db);
return $db;
}

3. Postgre Sql
define("HOST","localhost");
define("USER","venkat");
define("PASSWD","xxxx");
define("DATABASE","pos");
function myConn()
{
$db=pgsql_connect(HOST,USER,PASSWD);
pgsql_select_db(DATABASE,$db);
return $db;
}

That's it .....

Webserver :: Prevent Directory Listing

Step 1 :
>apache home>conf>httpd.conf
Do the following changes
First of all find your webserver root directiory , those lines are inside...

in my case , <Directory "C:/WWW/public_html"> is my webserer root

#Options Indexes FollowSymLinks //its enable directory listing
#disable directory listing
Options -FollowSymLinks -Indexes // prevent directory listing

thats it , save colse
restart apache !!!