anAppBuilder
asked on
mySQLDump from PHP gives empty file
I'm trying to run mysqldump from PHP on a shared hosting server. For some reason the dump is failing and I'm getting a 0 length file.
I've included a code snippet and the results below. Note that if I put in the "or die" it dies.
I've included a code snippet and the results below. Note that if I put in the "or die" it dies.
CODE SNIPPET
//Verify that the DB and user info is good
$dbLink = mysql_connect($custDBHost, $custDBUser, $custDBPswd);
print "dbLink = $dbLink<br><br>";
$ok = mysql_select_db($custDBName, $dbLink);
print "ok = $ok<br><br>";
//Now try the dump
$command = "mysqldump --opt --h=$custDBHost --u=$custDBUser --p=$custDBPswd $custDBName > $backupFile";
system($command, $retVar); // or die('could not write file');
print "retVar=$retVar";
OUTPUTOUTPUT
dbLink = Resource id #5
ok = 1
retVar=3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Adding the second dash works.
ASKER
It still gets a 0 length file. I posted the new snippet.
Is there a way to get more info about the error?
Open in new window