automatic dump

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dekkert
Forum Newbie
Posts: 4
Joined: Fri Mar 07, 2003 8:47 am

automatic dump

Post 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.
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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
dekkert
Forum Newbie
Posts: 4
Joined: Fri Mar 07, 2003 8:47 am

Post 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?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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..
dekkert
Forum Newbie
Posts: 4
Joined: Fri Mar 07, 2003 8:47 am

Post 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.
dekkert
Forum Newbie
Posts: 4
Joined: Fri Mar 07, 2003 8:47 am

Post 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?
Post Reply