I am while using exact code that 1and1 indicates for copying MySQL DBs through mysqldump (http://faq.1and1.co.united kingdom/archive/43.html)
$host= 'xxxx' $user= 'xxxx' $pass= 'xxxx' $db= 'xxxx' system(sprintf( 'mysqldump --opt -h%s -u%s -p%s %s gzip > %s/backup/' . time() . '.sql.gz', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT') ))
Have transformed all permissions to 777 for reasons of testing. Still no luck. Ongoing to find the error (errno 32 on write).
Any assistance is appreciated - this appears just like a stupid fix.
If you are carrying this out from the cron job, then
DOCUMENT_ROOT will not exist. The
DOCUMENT_ROOT along with other
$_SERVER variables are effectively setup through the web server (see the $_SERVER manual page), and when you are running the script from cron, there is no web server involved. See this earlier, similar question.
Try setting the road to your backup directory in accordance with the position of the PHP script. For instance, in case your script is within
.../your_folder/scripts/backup_script.php, as well as your (pre-produced) backup directory is
$backup_dir = dirname(__FILE__) . '/../backup'
...after which use
$backup_dir rather than
It's much like your hosts's instructions are correct, but only when running the script on the internet server, not in the command line.