Gaurav,
Running a jabber server (most popular ones are the erlang based
ejabberd and my fav is lua based prosody), requires a dedicated server
with root privileges. If you're running a simple LAMP server and have
hosted space on it, then it's difficult to build chat servers.
The trouble is that you need to *push* the data to the users over
http, realtime, as the data is coming in to your server. This requires
keeping a http connection open persistantly, or by having the client
use XMLHttpRequests to poll your server repeatedly. Either way is very
difficult and unscalable.
The trouble with using php here, is that php's security settings
require any http request to time out quickly, so maintaining
persistent connections is hard, and your server will go down moment
you hit about 20 connections, because each process gets it's own
thread.
The thing you're looking for is a "comet" server, usually people go in
for xmpp and ejabberd, but figuring out how to configure them with
your http server frontend is going to be difficult - most people like
facebook, etc use homebrew, rpc based techniques.
In essence, you're better off getting a hosted chat widget (like the
one mibbit provides) rather than write one/use one on your own server.
Because chat isn't easy to implement and run.
Thanks,
Anirudh
--
Senior undergraduate student, Indian Institute of Technology, Kharagpur.
http://anirudhsanjeev.org