I have a site with 1and1 - who is useless! For some reason, the backup scripts that they provide no longer work, and they cannot provide me with an answer! So I decided to write my own, this is my code:
if (file_exists('backupfile.sql')){
$FP = fopen ( 'backupfile.sql', 'r' );
$READ = fread ( $FP, filesize ( 'backupfile.sql') );
$READ = explode ( ";\n", $READ );
foreach ( $READ AS $RED )
{
mysql_query ( $RED );
}
echo 'Done';
}else{
echo "no file";
}
however this gives me the following error
Warning: fread() [function.fread]: Length parameter must be greater than 0
if I put @infront in fread, the script does not raise an error, but does not back up.
source
share