if you are want to know the real filepath to your directory on the server
$DIRNAME ='/home/sites/site47/web/backup/';
//$keep_file can be TRUE or FALSE. The temporary file will be deleted if you say FALSE.
//FALSE is recommended because with TRUE your server will accumulate dump files!
$keep_file = FALSE;
// MAIL details
// TRUE if you want the result to be send to you by mail
$SENDbyMAIL =TRUE ;
// who gets it? for multiple recipients, divide email addresses with a comma 'x@x.x,y@y.y,z@z.z'
$mailto = 'your@email.govl';
$From = 'Your website'; // gets shown as mail sender. can be anything.
$message = "\nThis is a backup created by a script on your site. \nThe location of the script is ".__FILE__.'.';
//Set $DEBUG to TRUE while setting up the script, until the script works.
//when set to FALSE, the script gives no output!
$DEBUG = FALSE;
//======CODE================================
//create a filename for the email. the date and time at the start of the filename make it easy to sort it
$filename=date("Y_m_d__H_i").$MYSQL_DB.".sql";
$fpname=$DIRNAME.$filename;
if ($DEBUG) { error_reporting(E_ALL);
if (!file_exists($PATHTOMYSQLDUMP.'mysqldump'))
{//echo "
The function Mysqldump does not exist or the location you gave, $PATHTOMYSQLDUMP, is wrong.\n\n";
$hereis=`whereis mysqldump`;
$hereis=substr($hereis,0,strpos($hereis,'dump ')+4);
$hereis=substr($hereis,strpos($hereis,' ')+1 );//the path to mysqldump!
if ($hereis=='') {echo '
I\'m sorry but i cannot find mysqldump on this server. You cannot use this script, unless you are very sure about the path, but the path you entered now is not valid. Try to use PHPMyAdmin\'s database dump function.';}
if (strpos($PATHTOMYSQLDUMP,'mysqldump')>0) echo 'You have the word "mysqldump" in the variable $PATHTOMYSQLDUMP. Please remove the word mysqldump!';
echo '
Maybe the path you gave in the settings is wrong. In the settings you have set $PATHTOMYSQLDUMP = '.$PATHTOMYSQLDUMP.';.
I have found this path: '.$hereis.'';
exit;
}
$hereisphp=`whereis php`;
$hereisphp=substr($hereisphp,0,strpos($hereisphp,'php ')+1);
$hereisphp=substr($hereisphp,strpos($hereisphp,' ')+1 );//the path to php!
if ($hereisphp!='') {echo '
| For your information: i seem to have found the PHP script here '.$hereis ."!\n" .'If you would like to run this script through a cron job, that would most likely be possible! |
| // 30 04 * * * '.$hereisphp.' -q '. $SCRIPT_FILENAME .' |