純粋な PHP ソリューションを使用して、基本的なものから中程度の複雑さのユース ケースの実行可能ファイルmysqldump-php
の機能を複製します。mysqldump
ホスト上でこれは機能します:
したがって、次の純粋な PHP スクリプトを /www/ のセキュア ディレクトリから直接実行するだけで、そこに出力ファイルが書き込まれ、wget で取得できるはずです。
mysqldump-php - GitHub の純粋な PHP mysqldump
PHP の例:
<?php
require('database_connection.php');
require('mysql-dump.php')
$dumpSettings = array(
'include-tables' => array('table1', 'table2'),
'exclude-tables' => array('table3', 'table4'),
'compress' => CompressMethod::GZIP, /* CompressMethod::[GZIP, BZIP2, NONE] */
'no-data' => false,
'add-drop-table' => false,
'single-transaction' => true,
'lock-tables' => false,
'add-locks' => true,
'extended-insert' => true
);
$dump = new MySQLDump('database','database_user','database_pass','localhost', $dumpSettings);
$dump->start('forum_dump.sql.gz');
?>