PHP exec() function is usually disabled in most shared web hosting servers because of security reasons, but if you are on VPS or dedicated server, you could use exec commands to backup your website or mysql database. Before you start, using code below check whether exec is enabled, if it fails you should ask your host to make sure it is even allowed!
The following exec command should back-up your website folder.
Back-up MySql database
To back-up your MySql database, simply copy/paste this code in a PHP file, change to your MySql credentials and run.