Page 1 of 1
automatic dump
Posted: Fri Mar 07, 2003 8:47 am
by dekkert
If I use phpmyadmin i can download a zipped version of the dump.
My provider has a (restricted) version of phpmyadmin in use and I can start skripts based on a timetable.
How can I write a php-skript to dump and send my database via email?
If I have a file I can emai it, the real problem is the dump.
Posted: Fri Mar 07, 2003 9:13 am
by Stoker
use mysqldump
something like
passthru ('/usr/bin/mysqldump -u username --password="mypass" --opt databasename | gzip -c')
will directly output the binary/compressed data.. if you need the data to a variable I suggest using `backticks` but i am not sure if that is binary safe.. If you want it directly to a file just add > filename at the end
Posted: Fri Mar 07, 2003 9:28 am
by dekkert
Stoker wrote:
passthru ('/usr/bin/mysqldump -u username --password="mypass" --opt databasename | gzip -c')
That sound good, but I believe I cannot start any passthru on the server from my internet service provider.
Therefore I am looking for a "native" php Solution. phpmyadmin uses some functions i have seen in there php-files. But I cannot find any function to call for this.
Any other idea?
Posted: Fri Mar 07, 2003 9:37 am
by Stoker
shell functions will not work if PHP is in safe_mode or if shell_exec() is disabled .. have you thried? mysqldump will do it a lot faster and more efficient than any PHP code will..
Posted: Fri Mar 07, 2003 9:40 am
by dekkert
Stoker wrote:shell functions will not work if PHP is in safe_mode or if shell_exec() is disabled .. have you thried?
I will try it on(?) the weekend. If it doesn't work, I write here again. Thanks.
Posted: Sat Mar 08, 2003 2:46 am
by dekkert
I have tried. And it doesn't work. It would be the save modus.
How can I see the Error Message.
Is there a way to use the dump from phpmyadmin?
Thanks?