Re: [PHP] PHP and databases? ...without MySQL and such

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Darren,

working as consultant, I get this question asked all the time - None of
my clients wants to lose their money on development.

Here's what I think:


On Tue, 22 Oct 2002 17:15:05 -0400 (EDT) Darren Henderson <darren@bmv.state.me.us> wrote:

> All things are relative. 

Correct. They always are.

> Data bases are not always appropriate. Sometimes they may even be
> detrimental.

> There is a cost in complexity, resources and support when using a data base.
>
> MySQL is "expensive", in terms mentioned above, if all you are doing is
> maintaing a configuration file,


Yes, for configuration purposes it is more clever using flat files. BUT,
for as long as you don't need (and know you'll never need) any of the
following three things:

1. Anything more than just one single PHP file made in your text editor.

2. Dynamically modifying your configuration files.

3. Per-user based configurations like to store things for later,
   frequent use.

> or a low volume shopping cart system, 

Completely wrong. Normally, (at 90% at least) when you think of running
a shopping cart, even of a low volume but with use of PHP, you'd think
of database as it is:

1. Simpler developing a database in SQL than in some Flat Files logic.
   This means investment saving.

2. Having the possibility of an unpredicted business growth. For
   instance, some inexperienced developers not know that a Linux system
   cannot hold over a certain amount of files within the same directory 
   (1024 I think), and they all of the sudden end up re-developing the
   whole thing because data becomes too large to store and system
   crashes. What means the day business became more profitable you lose
   a bunch of money for the downtime or speedy-redeveloping. A very
   expensive risk to run. Always, unless you are selling one single
   service that can never be more than just that one. But again, the
   flat HTML pages will do :)

Two very good reasons why to start an e-commerce site from a database
even if there are only 10 things to store.

> or looking for simple access control.

Agreed and disagreed: Yes, it may sound that it is easier to access a
file than a database, but at the same time there are less worries
maintaining that file.Remember, you'll need to be locking AND unlocking
a self-updating file as there is a risk of corrupting and lose all your
data, besides getting errors all the time, on multi-threaded web servers
if the file happens to be saved simultaneously within different
requests. Very possible to happen with even 100 visits per day.

Plus, you forgot to mention the three most important things:

1. Data Integrity:
   Something that needs to be taken care of in order not to mess the
   data the data. Similar to above.

2. Security:
   A file can be read by anything within the server while DB needs a
   password. Few that think a DB is "expensive" own their dedicated
   servers.
   
3. Performance:
   Just store a few variables will work with a flat file, but doing a
   little search within the data will decrease site's response times 
   tremendously.
   
> Using a db to store php hashes in can be remarkably simple and effective in
> the right situations.

Indeed it is.

Conclusion: 

1. Flat files - for site configurations
2. Database   - for data manipulations

There are really few (almost none) cases when you should to store within
Flat Files what you can call "DATA" instead of "CONFIGURATION". One of
these big reasons, ironically, is: one doesn't have a database :)

Take care,

---
Maxim Maletsky
maxim@php.net


www.PHPBeginner.com  // PHP for Beginners
www.maxim.cx         // my Home

// my Wish List:     ( Get me something! )
http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux