1

I am dealing with a good web host but the problem is that they limit mysql to 1 database of 25MB

The problem is that I need more but can't afford to pay more for the moment.

Is there any solution like a .dat file or any type of flat file database with basic management.

I'ts not going to be very big but it has to be many databases because I have to run more than one site on that hosting plan.

Thanks

med
  • 227
  • 2
  • 3
  • 5

3 Answers3

2

There's SQLite

<?php
if ($db = sqlite_open('my.db', 0666, $sqliteerror)) { 
    sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))');
    sqlite_query($db, "INSERT INTO foo VALUES ('fnord')");
    $result = sqlite_query($db, 'SELECT bar FROM foo');
    var_dump(sqlite_fetch_array($result)); 
} else {
    die($sqliteerror);
}
?>
Leigh
  • 12,859
  • 3
  • 39
  • 60
  • thanks for all of your answers, I already know sqlite but really don't know what to do with it, I thought it's just an alternative for mySQL. So do you think that I can use it on a shared web hosting technically and legally while they restrict the mySQL use? – med Feb 05 '11 at 00:21
  • @med: there's no reason not to be able to. The limit on mySQL (or other DBMS) is because there needs to be a process running all of the time to run these. SQLite just accesses the file like any other file. You may run into contention problems with SQLite, I'm not sure. – Matthew Schinckel Feb 05 '11 at 00:30
  • @med Have a read through the PHP [Database Extensions](http://uk3.php.net/manual/en/refs.database.php) documentation, there's a few others that offer file access (dBase, Paradox, etc), you just need to check which extensions are compiled into your servers PHP module ([phpinfo()](http://uk3.php.net/manual/en/function.phpinfo.php)). – Leigh Feb 05 '11 at 00:57
0

I think what you might be looking for is SQLite...

Daniel Kutik
  • 6,997
  • 2
  • 27
  • 34
0

As others note, SQLite is a consideration, although you will want to be aware of limitations:

http://www.sqlite.org/limits.html

If you are on a Windows Server system (not likely, but possible), you can use Access, and connect with ODBC:

http://www.w3schools.com/PHP/php_db_odbc.asp

Also, maybe Firebird:

http://www.firebirdsql.org/

However, just note some things before you get too far into it.

  1. File locking - having multiple users at once can lock out request responses until the locks are cleared
  2. File access - if you put a file within your HTML directory, you will need to take precautions against allowing other people to download you database; best to keep it off your public path altogether
  3. Optimization - MySQL and PostgreSQL are going to work much better; none of these other options are going to scale gracefully, which leads me to my last note...
  4. Undoing what you've wrought - When you get your sites large enough to require a better database system, you could find yourself needing to redo a bunch of code or finding a way to port your data to a new setup

Seriously consider whether you can store it all together, or maybe look into another provider which can help make it more affordable. For instance, I've liked Dreamhost ($8.95/month for 5 databases), although my favorite provider is MediaTemple, who I used for several years and cost about $22/month. There are others out there that are similarly competitive, even Amazon Web Services.

Jared Farrish
  • 48,585
  • 17
  • 95
  • 104