我如何在lighttpd中执行mysqldump? 用php

I'm trying to export and import database in lighttpd using php. Mysqldump does not work as is:

$command= 'mysqldump -h localhost -u root -pXXXX db_name > backup.sql';
exec($command);

I was using Palapa Webserver and it turns out the mysqldump application is not included. Sorry, should have checked this first and I also should have been clear that I was using Palapa Webserver.

I just ended up using import and export functions that I found.

Import:

how to import .sql file in mysql database using php

Export:

http://davidwalsh.name/backup-mysql-database-php

Thanks

If you want to download it from browser just use passthru

passthru('mysqldump -h localhost -u root -pXXXX db_name');