包括在PHP中使用system(mysqldump)备份数据库文件的路径或位置 [英] Include a path or location where to backup database file using system(mysqldump) in PHP

查看:155
本文介绍了包括在PHP中使用system(mysqldump)备份数据库文件的路径或位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我想在其中创建备份数据库的位置包含一个位置,但是当我在我的代码中包含将在其中创建备份数据库的位置时,该代码不起作用,并且也没有创建数据库文件.指定位置.但是,当我删除路径时,代码可以正常工作,请您帮我解决这个问题,因为我需要此来完成我的管理模块,并且我希望所有备份数据都在一个文件夹中创建.这是我的代码

Greetings,

i want to include a location on where my backup database will be created, but when i include a path on where the backup database will be created in my code, the code doesn''t working and there is no database file being created to the specified location. but when i remove the path, the code works properly can please you please help me on this, cause i need this to complete my admin module, and i want all the backup data to be created in one single folder. here''s my code

$dbhost = ''localhost'';
$dbuser = ''username'';
$dbpass = ''password'';
$dbname = ''databasename'';
			
			   
$path = ''home2/tintinba/public_html/test/admin/backup/'';
			   
$backupFile = $path . $dbname . date("Y-m-d-H-i-s") . ''.gz'';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";

system($command);


推荐答案

dbhost ="localhost";
dbhost = ''localhost'';


dbuser =``用户名'';
dbuser = ''username'';


dbpass =``密码'';
dbpass = ''password'';


这篇关于包括在PHP中使用system(mysqldump)备份数据库文件的路径或位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆