NYCPHP Meetup

NYPHP.org

using exec or backticks

Ian Forsyth ian at plusfour.org
Fri Jun 28 10:26:33 EDT 2002


I am trying to do a mysqldump using php..

$command = "mysqldump -h localhost -u ian --password=something --opt
adatabase > db.sql";
$result = `$command`;

or exec("mysqldump -h localhost -u ian --password=something --opt adatabase
> db.sql");

but on red-hat or mac os X (aka freebsd) i get nothing.. not even an empty
file named db.sql..

On my windows machine even is my login was incorrect, a file was still
generated..

which leads me to believe, for linux, is it an issue of permissions?

$a = array();
$int = 1;
$c = "ls";
exec($c,$a,$int);
print_r($a);

on both linux and windows. I get the same results from the above.. so it
must be permissions.. should i try running it as a cgi?

Ian..




More information about the talk mailing list