Re: mysqldump
| From: | Aaron Todd | Date: | Tue, 09 Nov 2004 19:12:07 +0000 |
| Subject: | Re: mysqldump | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37214@lists.php.net to get a copy of this message | ||
Jason,
I tried the double quotes but that didn't seem to matter. I also put the
command string in a variable and then am running the variable with exec.
Still it doesnt work.
$filename = "/home/virtual/site341/fst/var/www/html/db_backup_" .
date("n-j-y").".sql";
$command = "/home/virtual/site341/fst/usr/bin/mysqldump -u ***** -p*****
database > $filename";
echo $command;
exec($command);
Thanks for your post,
Aaron
"Jason Wong" <php-db@gremlins.biz> wrote in message
news:200411100231.47818.php-db@gremlins.biz...
> On Tuesday 09 November 2004 17:59, Aaron Todd wrote:
>> I have created a PHP script that looks like:
>>
>> <?php
>> $filename = "/var/www/html/db_backup_" .
>> date("n-j-y").".sql";
>> exec('mysqldump -u ***** -p***** database > $filename');
>> ?>
>>
>> For some reason this doesnt work and I cant figure out why. There is no
>> error that comes back. When I run the mysqldump command from the server
>> console it produces the file fine. I have read a few other posts out
>> there
>> about this same thing which resulted in the location the file was being
>> saved. But I have gone through my server and found nothing. Does anyone
>> have any suggestions for regarding this.
>
> Try using double quotes.
>
> Also just like performing SQL queries, it's a very good idea to build up
> the
> command you want executed, store it in a string ($cmd), then echo it to
> see
> whether it looks good, then exec($cmd).
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> ------------------------------------------
> /*
> Save the bales!
> */