I follow this and it working well in Window
But when i run in ubuntu (13.10) and using xampp
<?php
$server = "localhost";
$username = "root";
$password = "root";
$db = "test";
$restore_file = "/home/myname/test.sql";
$cmd = "/opt/lampp/bin/mysql -h {$server} -u {$username} -p{$password} {$db} < $restore_file";
//umask(0);
exec($cmd);
echo "Restore complete!";
?>
it echo restore complete but database is empty. If i run script on terminal then it working.
How to fix that thanks
What is O/P?
<?php
if(function_exists('exec')) {
echo "exec function is enabled";
}
else {
echo "exec is not enabled";
}
?>
Edit
Execute this command in shell.
chmod +x /opt/lampp/bin/mysql
Edit
exec($cmd, $output, $return);
echo $output;
if (!$return) {
echo "Success";
} else {
echo "Failed";
}