Taking Database Backup And Moving that backup from one server to another using PHP

|
| By Webner

While working on two servers, we can take the backup of database on one server using mysqldump command in php.

Example :
exec(‘mysqldump –host ‘.$dbhost.’ –user ‘.$dbuser.’ –password=’.$dbpass.” “. $dbname.’ > ‘.$dbname.’.sql’);

After creating dump of database, user can move the dump database file from one server to another using FTP(FILE TRANSFER PROTOCOL). Following are the FTP steps to take backup from one server to another :

1. ftp_connect : Firstly We have to connect with ftp using hostname.
2. ftp_login : Then we have to login using connect we created using ftp_connect.
3. ftp_put : This method is used to move the file from one server to another.
4. ftp_get : This method is used to get the file from another server.
5. ftp_close : At Last, close the Connection.

One comment

  1. Pingback: Homepage

Leave a Reply

Your email address will not be published. Required fields are marked *