简体   繁体   中英

PHP mysqldump creates empty file

I'm trying run exec with mysqldump in my PHP file. It doesn't work, I'm even trying to use it without variables like this:

exec('mysqldump --user=xx --password=xx --host=xx db settings > /output/dump5.sql');

It creates empty file.

But when I run this command in ssh, it works. Why?

Do you need to do this from php script?

I assume that you want to do the backup frequently, so maybe adding it to cron job will better solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM