mysqldump and OS X
| From: | Richard Dyce | Date: | Mon, 09 May 2005 22:40:27 +0000 |
| Subject: | mysqldump and OS X | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39403@lists.php.net to get a copy of this message | ||
Wonder if anyone out there can help?
I'm trying to execute a mysql dump on my local Mac (running 10.4), and I'm running into an odd problem, possibly something to do with permissions or $PATH setup.
Here's the code...
<?php
$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'blah';
$dbname = 'property_rental';
$filepath = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
$filename = "$filepath/data.sql";
passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname >$filename");
?>
Now, if I execute this on the remote server, with the correct login details, it all works tickety-boo. If I execute it locally on my Mac using the built-in Apache server and a localhost address. But if I change the passthru call to an echo, and then copy and past the result into the terminal app, it works. What am I doing wrong? Any ideas greatfully received.
R