我有一个PHP脚本来将数据库备份到文件中。它已经工作多年了,但是在服务器上发生了一些变化,现在它无法正常工作。
var $ working是“2”,“$ output”是空的(我试图回应它)。用户名,密码等在原始脚本中是正确的。
如何查看邮件错误?
$mysqlDatabaseName ='databaseName';
$mysqlUserName ='userName';
$mysqlPassword ='passw';
$mysqlHostName ='hostName';
$mysqlExportPath ='folder/name.sql';
$command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' > ~/' .$mysqlExportPath;
exec($command,$output=array(),$worked);
switch($worked){
case 0:
echo 'Database <b>' .$mysqlDatabaseName .'</b> successfully exported to <b>~/' .$mysqlExportPath .'</b>';
break;
case 1:
echo 'There was a warning during the export of <b>' .$mysqlDatabaseName .'</b> to <b>~/' .$mysqlExportPath .'</b>';
break;
case 2:
echo 'There was an error during export.';
break;
}
感谢。