I have a problem while trying to make a backup of mysql using php, I got a script from somewhere on the internet, it saves the file but it is empty, is there anything wrong with the following code or there can be something on my server that does not let to get the backup?
Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --all-databases [OPTIONS] For more options, use mysqldump --help
Yep it is a dedicated server so I have full access. What is that $list variable? I want to run through php since I found some scripts on internet that make a backup and send it via email.
It is really weird, via SSH it worked great. When I write a wrong password in PHP it does not give me a file at all, just when the credentials are correct it give me the blank file.
p.s. is there any way to get the mysql backup through php?
MicroBoy wrote:p.s. is there any way to get the mysql backup through php?
What I posted was how I run MYSQLDUMP with PHP. The special tick quotes cause PHP to run that string in the shell.
Perhaps the directory you're running it in doesn't have permissions for writing when you are in the shell, but via SSH you're user is elevated...? I don't know.
I can't usually run things in the shell on shared hosts, so I use my own PHP backup scripts which also encrypt and FTP the data off site. Probably similar to what you downloaded. The script just uses standard SQL queries to build up a .sql file.
Maybe you don't understand what I posted. These do the same things (mine also GZips the file up). And $output contains the printed results into a PHP variable so you can redisplay them.