sultan
sultan

Reputation: 6058

PHP mysqldump doesn't work

I've the code shown below but nothing happens after execution

system('mysqldump -u USER -pPASS DB > /tmp/bckp.sql');

What is wrong with this code?

Sultan

Upvotes: 2

Views: 1541

Answers (2)

Mark
Mark

Reputation: 6254

You most likely need to specify the full path to mysqldump as it probably isn't in your PATH environment variable for the user PHP is running as. Go to command line on the server and run

which mysqldump 

It will spit out the full path. Then replace mysqldump in your system() command with that full path

Upvotes: 2

oezi
oezi

Reputation: 51817

there could be thausands of things going wrong:

  • do you get any error messages?
  • have you tried to echo system(... - and whats the result?
  • what is the return value?
  • have you tried to use exec or passthru instead?
  • are you sure your db-name, user and password are spelled correctly?
  • what happens if you fire that command on the terminal on your own?

some more information would be realy useful to help you.

Upvotes: 1

Related Questions