mysql - PHP variable to .sql, zip it and then download -


i generating mysql script. result this...

insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); 

there on 10,000 lines. assigning variable called $sql_dump

i download variable using following script...

header("content-type: text/plain"); header("content-disposition: attachment; filename=backup_export.sql"); echo $sql_dump; 

it working fine. however, file big can big 20mb. instead of downloading .sql file. want zip , download it. don't want keep on server. should generate on fly. dump mysql phpmyadmin, when choose download zipped.

please thanks

you can use php exec function compress file zip server function, after sql file generated. after need check if file exist , download it. need have folder store files , rutine clean server, mean delete zip generated files.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -