My name is Richard Watson and I'm a professional PHP developer
from Lurgan in Northern Ireland
Posted by richard
News | 25-11-2015
A brief how-to on how to dump a large database using PHP in a Windows environment where PHPMyAdmin struggles with the size of the database being exported.
First, 2 things:
# Note that constant definitions are actually taken from the Imprete CMS;
# You could just as easily use variables to achieve the same data, e.g. $db_host, $db_name etc.
# You can modify this as you prefer. It's not exactly infallible as a file naming convention as duplication is possible
$filename = date("d-m-Y_g-is") . ".sql";
$result = exec('c:\\xampp\\mysql\\bin\\mysqldump -h ' . DB_HOST . ' -u' . DB_USER . ' -p' . DB_PASS . ' ' . DB_NAME . ' > ./application/backup/sql/' . $filename, $result);
Frameworks & tools
Bugs & faults