Note that there are some explanatory texts on larger screens.

plurals
  1. POGeneral purpose remote data backup and download - including InnoDb support
    primarykey
    data
    text
    <p>I want a PHP based solution to backup database (only data and not code) of a remote server and download the file. I know that Shell based solutions are better for doing such things (running a shell script on local system and connecting through SSH to remote system) but it is a requirement to have a PHP based solution where knowing a URL and having database credentials is enough for a non-techie to take backups. The PHP script can be uploaded to the remote server and executed.</p> <p>Following are the <strong>features</strong> I want:-</p> <ul> <li>Should have support for InnoDb engine at least - foreign key constraints should be exported. No harm if it supports all other engines.</li> <li><p>Should work on all servers, in the presence of the maximum possible amount of restrictions (I know about a few restrictions like <code>safe_mode</code> enabled, <code>exec()</code>, <code>system()</code> functions disabled etc.). I want a very general purpose solution which is guaranteed to work anywhere.</p></li> <li><p>Process should be password authenticated (asks for database credentials). </p></li> </ul> <p>Now, I am breaking down things and starting from the very basics. Following are my assumptions of things so far and some <strong>questions</strong>:-</p> <ol> <li><p>I am not sure if system functions like <code>exec</code>, <code>system</code> etc. can be completely disabled in shared hosting servers or not. If they are disabled such that they cannot be overridden, then the <code>mysqldump</code> based solution given <a href="https://stackoverflow.com/questions/4576025/web-site-backup-in-php/4686627#4686627">here</a> will not work universally.<br> <strong>Question -</strong> If however only <code>safe_mode</code> is on such that system functions can execute on files present inside <code>safe_mode_exec_dir</code>, will the solution work securely? </p></li> <li><p>I asked a question regarding <a href="https://stackoverflow.com/questions/4680060/security-risks-and-appropriate-measures-while-using-php-for-taking-database-dumps">security risks of doing this using PHP</a> and understood that the backup file should never be created (I assume, in case of a <code>mysqldump</code> based solution, backup file needs to be created first before downloading) in the webspace. So, the solution should not need the backup files to be created there (no problem if creates in other locations).<br> <strong>Question -</strong> But, will shared hosting providers allow this?</p></li> <li><p>I checked out various general-purpose user contributed PHP classes like <a href="http://www.phpclasses.org/package/1058-PHP-Backup-a-mysql-database-without-mysqldump.html" rel="nofollow noreferrer">phpmysqldump</a> etc. and did not find the usage of <code>mysqldump</code> based solution using system commands there to take backup. They do things like <code>SHOW CREATE TABLE</code> etc. to get all the table creation, data insertion queries and then download those things without actually saving it as a file (so no security risk).<br> <strong>Question -</strong> Am I correct to conclude that they do all these things without doing a simple <code>mysqldump</code> as given in the solution in the first point because this cannot be a general purpose and secure solution?<br> <strong>Question -</strong> Also, I read that there aren't any good ones which work well. I personally used only this <a href="http://www.phpclasses.org/package/1058-PHP-Backup-a-mysql-database-without-mysqldump.html" rel="nofollow noreferrer">phpmysqldump</a> and it gives me mysql errors when I try to restore a database with the backup created. The queries in the dump file also look somewhat different from those created by PhpMyAdmin's export module. I also checked a few other free user contributed PHP classes. It looks like most of them do not support InnoDb support and so foriegn key constraints, if present in the database are not present in the export.<br> <strong>Question -</strong> The export functionality of PhpMyAdmin itself, if present separately could be the solution for me, I guess. Does anybody know of any stable library like this one?</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload