0

I have a little PHP script to backup a database to a file. It has been working for years but something changed in the server and now it doesn't work.

The var $worked is "2" and "$output" is empty (I tried to echo it). The username, passw etc are correct in the original script.

How can I see some message error?

$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;

}

Thanks.

Oscardr
  • 113
  • 1
  • 6
  • 1
    Possible duplicate of [PHP regular backup of mysql data](http://stackoverflow.com/questions/38916163/php-regular-backup-of-mysql-data) – e4c5 Sep 15 '16 at 12:22
  • Possible duplicate? It's not like this question, here I want to know how can I see some message error (or help of someone if he can see it) – Oscardr Sep 15 '16 at 12:36

0 Answers0