开发者

Dealing with hosts with no mysql

I am dealing with开发者_JAVA百科 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


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);
}
?>


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜