mysql - Mysqldump generat empty file in php -


i try save database in php not work work shell

with shell (work good)

mysqldump --user=root --password= --host=localhost site > c:\xamppp\htdocs\site\sql\tests.sql 

with php (file created empty)

system('mysqldump --user=root --password= --host=localhost site > c:\xamppp\htdocs\site\sql\test.sql', $result); 

for $result have 1

i work xamp on windows 7, test exec , system same you

$return_var = null; $output = null; $command = "mysqldump -u mysql-user -h your_host -pmysql-pass database_name > /directory_path/file.sql"; exec($command, $output, $return_var); 

or can refer answer mysqldump via php


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -