doufeng2877 2016-04-09 21:33
浏览 297

windows / php系统找不到路径指定的错误

I have this script to access my mysql database and do some maintenance.

I am on windows platform. Mysqldump is installed at C:\Program Files\MySQL\MySQL Server 5.7\bin and PHP.exe is installed at C:\TCAFiles\xampp\php

I have a database.php with

<?php


// Database Connection Setup
// -------------------------------------------------------
$dbhost = '127.0.0.1';
$dbname = 'dbname';
$dbuser = 'username';
$dbpass = 'password';
// -------------------------------------------------------
$db_local = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);

?>

I have a cleanup.php

<?php

// Set the protection period
$ProtectionPeriod = 97;

echo "================================
Database Cleanup Started:
================================
";

include 'database.php';

// Do db backup
// -------------------------------------------------------   


// if mysqldump is on the system path you do not need to specify the full path
// simply use "mysqldump --add-drop-table ..." in this case
$date = date("Y-m-d_H-i-s");
$dumpfname = 'D:\\Tinboye\\backups\\'.$dbname.'_'.$date.'.sql';
$command = "C:\\Program%20Files\\MySQL\MySQL%20Server%205.7\\bin\\mysqldump --add-drop-table --host=$dbhost --user=$dbuser --password=$dbpass  exile > $dumpfname"; 
system($command);

echo "backup $dumpfname made

";
// delete push bikes
$sql = "DELETE FROM vehicle WHERE class = 'Exile_Bike_OldBike' OR class = 'Exile_Bike_MountainBike'";
$result = mysqli_query($db_local, $sql);        

// Delete players not logged in for $ProtectionPeriod days with less than 10 total_connections
$sql = "DELETE FROM player WHERE account_uid IN (SELECT uid FROM account WHERE last_connect_at < NOW() - INTERVAL $ProtectionPeriod DAY)";
$result = mysqli_query($db_local, $sql);

// Remove empty containers not used in 48 hours
$sql = "DELETE FROM container WHERE last_updated_at <= NOW() - INTERVAL 48 HOUR AND cargo_items = '[[],[]]' AND cargo_magazines = '[]' AND cargo_weapons = '[]' AND cargo_container = '[]'";
$result = mysqli_query($db_local, $sql);

?> and a bat file to run the php script

@echo off

::=====================================================================================================================================

:: Database Housekeeping backup & clean

::=====================================================================================================================================

C:\TCAFiles\xampp\php\php.exe D:\Tinboye\servers\jnjexile\ExileCleanup\exile_cleanup.php

pause

but when i execute the script I get an error

================================

Database Cleanup Started:

The system cannot find the path specified. backup D:\Tinboye\backups\exile_dayz_2016-04-09_23-30-31.sql made

Press any key to continue . . . Terminate batch job (Y/N)?

when i go to the folder D:\Tinboye\backups there is the file created, but no data, which leads me to believe that the mysqldump is not found.

anyone see the problem here?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog