Web lists-archives.com

Re: [PHP] One Button DB backup





> On Nov 5, 2016, at 4:15 PM, Adam Jon Richardson <adamjonr@xxxxxxxxx> wrote:
> 
> On Sat, Nov 5, 2016 at 3:52 PM, Adam Jon Richardson <adamjonr@xxxxxxxxx>
> wrote:
> 
>> On Sat, Nov 5, 2016 at 3:41 PM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote:
>> 
>>> 
>>>> On Nov 5, 2016, at 10:12 AM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx>
>>> wrote:
>>>> 
>>>> On Fri, Nov 04, 2016 at 01:14:37PM -0400, Tedd Sperling wrote:
>>>> 
>>>>> Hi gang:
>>>>> 
>>>>> I am in need of a one-button backup of a database via a php script
>>> 
>> 
>> Something like this little bit of code works:
>> -snip-
> 
> Just a few quick follow-up points on this method:
> 
> 1) This approach shouldn't be used on a shared server, as the command-line
> logs could be viewed by others to gain the DB credentials (not an issue in
> the cases I've used this approach, as the server was only hosting one
> website.)
> 
> 2) I forgot that this approach requires no space between the password and
> the -p argument, so it should read:
> $command = "mysqldump --add-drop-table -h localhost " .
> "-u USERNAME -pPASSWORD DBNAME > FILETOPIPETO";
> $ret_val = null;
> // create current backup
> $output = system($command, $ret_val);
> 
> Adam

Adam:

Thanks — I think that will do it.

Cheers,

tedd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php