0

I've always used MySQL with PHP and on my site I added a chat system that uses MySQL which as you would know is VERY database heavy so I think I'm going to switch it over to XML files for each user just for the chat system to take all the load off of the DB.

I have never used XML with PHP before so I was looking for information, and found that the queries are pretty similar to MySQL.

Here are my questions:

  1. Is it the client writing to the file or the server writing to the file?
  2. Do I have to chmod them as 777?
  3. Do I also have to chmod the XML file as 777?
  4. If I do have to set the permissions to 777, does that drastically decrease security and is there any way to tighten that up?
  5. Does anyone have any tutorials they would recommend me to as well? Most of the stuff I found is from 2003 - 2005. Don't know how much has changed in it.

Hope it's cool I ask this question here.

Thanks a bunch -Sal

Travesty3
  • 14,351
  • 6
  • 61
  • 98
Silas
  • 582
  • 2
  • 9
  • 19
  • 1
    Mr Silas, using XML will just make this from bad to worse. The reason is simple, database help you to manage race condition nicely. – ajreal Mar 19 '12 at 12:48
  • 1
    Please format your question to make it more readable – Starx Mar 19 '12 at 12:48
  • So I shouldn't use XML files for this? Should I maybe setup another database? – Silas Mar 19 '12 at 12:50
  • 1
    Saving chat histroy in XML, I think, is not a good idea. You will have bigger access time, bigger load on the file system. Also, inserts would be very slow. And a lot of other minuses... – Timur Mar 19 '12 at 12:50
  • I'm just asking because I feel a chat system can clog up a DB fast. – Silas Mar 19 '12 at 12:51
  • @ajreal So MySQL will work faster and better with the way i have it set up? I only have the chat history saved up to like 2 days after that I erase it. I set it so when each conversation is started it creates a new row with a unique id, the 2 users chatting and the entire conversation for the chat session stored in 1 mediumtext cell – Silas Mar 19 '12 at 12:57
  • XML is very hard to manipulate and traverse for a quick response as such in chat. MySQL is not that heavy, if you use to properly and optimize the tables regularly. [See this answer](http://stackoverflow.com/a/2381658/295264) Check these tutorials to get you started. 1. http://css-tricks.com/jquery-php-chat/ 2. http://www.tutorialized.com/tutorial/Creating-a-private-chat-room-system-in-PHP/65411 3. http://www.php-development.ru/javascripts/ajax-chat.php – Starx Mar 19 '12 at 12:50
  • Thanks a bunch for taking the time to read and answer this Starx! – Silas Mar 19 '12 at 13:01

1 Answers1

1

First off, it seems like a very bad idea to do something that is very database intensive in xml, it is going to be a lot more intensive that way.

To answer your question; It is always the server writing to the server filesystem. you only need to provide write access to the user running apache (and consequently php).

I suggest you stick with mysql for chat but look into DOMDocument to learn more about xml

Kris
  • 40,604
  • 9
  • 72
  • 101
  • After all of everyone's advice I'm going to stick with MySQL I had no idea XML would suck so bad. I guess that's why all of the info I found on it was really old. I appreciate you taking the time to read and answer this! – Silas Mar 19 '12 at 13:01
  • You're welcome. though XML is definitely not a bad technology, just simply not the best tool for the job in this case. – Kris Mar 22 '12 at 12:41