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

Author - Deepika
17.03.2017
|
0 Comments
|

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.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

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