SPEEDYB.co.uk

Sunday th 14th of November 2004 at twenty to two in the afternoon
M y previously tempramental back-up system that worked once (I don't refer to once meaning in the past, I mean it's literaly only ever worked once, one singular occurance of recognisable functionality) has now completely stopped working.

So I guess I'll need to completely re-do that, if anyone has a suggestion on how to simply get a dump of a database at the press of a button, then please e-mail me.

Also on the tangent of things going hideously wrong and producing those lovely streams of ASCII we like to call errors, the MySQL error for UPD, when the site/server goes tits up has now been slightly refined so you don't get a bunch of crazy mess if (or more likely when) the server has a siezure. Lovely.
4 Comments
RSS Feeds Subscribe to: These comments, All Comments, All Posts
Gravatar
X-Istence @ 14 Nov 2004

Add a caching system in place, it saves a copy of your index.php when it gets generated, saves it to ./cache/index.cache and then when the MySQL dies, you can just call the cache, and have that displayed.

Means your site is always online :P. Also, if nothing has changed on your site, it means no MySQL queries!
Gravatar
X-Istence @ 14 Nov 2004

Oh, as for the backup, check if you can use exec() together with PHP, or even the backticks `ps auxww` and see if that works. If that works, then just have mysqladmin dump the database to the standard output into a $var of your choice, and then save that var to a file, or download it or whatever :P.

Makes your life easier.
Gravatar
SPeedY_B @ 14 Nov 2004

Caching was something that I was considering (very low priority at the moment though) just for the front page at least.

My old/existing backup uses an exec(); and just runs mysqldump into a file which I can then download, my problem with that is that the file is then sitting there with my Database in it, open to anyone clever enough to work out the path. I just want something that will put the entire DB into a temp file, pump that file to my browser so I can download it, then delete the file.

Tis a pain in the arse.
Gravatar
X-Istence @ 15 Nov 2004

Don't pipe the output to a file from MySQL admin :P.

mysqadmin when asked to dump the DB is asked to send it to stdout, which means if you $var = exec(...); $var will contain your DB now.

Then just:

echo $var;
and your set. Just make sure to add some extra headers to let the browser know it is text. And you are set :D.
Add Your Comment...
Name
Web site (optional)
E-Mail (optional, used for Gravatar)