Get Your Database Backup Sent to You Via Email
It's good practice to backup your mysql database often. How often depends on how important your data is.
I've been using a utility called dbsender to backup my database and send it to me via email for a few of months now but have never received the email attachment. I get the email saying it's attached, but no attachment. I know the database backups are in the dbsender folder and my database is getting backed up weekly. If ever anything goes wrong, I'll always have a recent backup.
Today, however, I investigated the email sending part of the script, and to my disgust I realised the problem all along has been permissions. After reading a post on a hosting forum, I changed the file and folder permissions to 770, rather than 777 as was recommended in the script, and everything is working. Such a simple little fix that's been a problem for months.
I set it up outside of my public_html directory and made the changes to the file as explained in the comments.
I then set up a crontab to run it once a week, you can do this daily if you wish, and used
php -q /home/username/dbsender/dbsender.php > /dev /null
as the command. I set the permissions to 770 on the actual file and the folder.
When the file runs it will use gzip to compress the file then send the file to me via email or ftp.



Leave a comment