Git   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何每天从另一台服务器自动加载数据大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

您好我需要创build一个自动连接到另一个服务器使用PHP库,然后我需要加载数据在MysqL数据库只有第一个file upload一个新的file upload每天。 问题是我如何每天继续上传文件数据库我几乎在那里

这里是代码

<?PHP include 'core/init.PHP'; include 'includes/overall/header.PHP'; //connection to linux server $conn = ssh2_connect('xxx.xxx.xx.xxx',22); $desTinationPath = '/path/to/desTination/path/'; $localPath = 'C:pathtolocalpath'; //checks if the connection is successful or not if(ssh2_auth_password($conn,'username','password')){ echo '<script type="text/javascript">alert("Authentication was successful"); </script>'; //javascript pop up when successful }else{ die("Authentication Failed"); } if(ssh2_scp_recv($conn,$desTinationPath,$localPath)){ echo '<h2>Todays file recieved</h2>'; //if file was recieved from server to local echo todays file recieved,putTing the file in localpath }else{ //if the file was not uploaded send an email for radar file too be uploaded $to = 'testemail@yahoo.co.uk'; $subject = 'the subject'; $message = 'Hello'; $headers = "From: The Sender Name <senderEmail@yahoo.co.uk>rn"; $headers .= "Reply-To: senderEmail@yahoo.coomrn"; $headers .= "Content-type: text/htmlrn"; mail($to,$subject,$message,$headers);

}

$String = file_get_contents('http://localhost/Prototype/core/edit.txt','r');//get contents of file from web used to read the file $myFile = 'C:wampwwwPrototypecoreedit.txt';//file directory $fh = fopen($myFile,'w') or die("Could not open: " .MysqL_error());//open the file fwrite($fh,$String); fclose($fh); $result = MysqL_query("LOAD DATA LOCAL INFILE '$myFile'". "INTO TABLE `restartdata` FIELDS TERMINATED BY ',' "); if (!$result) { die("Could not load." . MysqL_error()); }else{ echo 'data loaded in the database'; }

这是什么意思在sHell脚本中是SCRIPTNAME =“$ {0 ## * /}”?

Bash:用bash脚本进行头部和尾部行为

Bash脚本 – pipe理服务器导航

@H_411_0@mmap vs大分配的静态分配

我需要在Linux 3.12驱动程序中“启用”PCIe内存区域吗?

如何在Ubuntu Linux启动时运行Java应用程序

如何计算Makefile中的范围

我目前使用的是什么c + +规范?

在golang中回答密码sHell提示

ARM-GCC在Fedora 21下生成错误

绝对不使用PHP。 绝对没有什么是自制的。 有一个内置的机制。 这就是所谓的复制经过15年以上的尝试和测试,并且正在成千上万的安装中使用。

通过复制,可以将来自一个MysqL数据库服务器(主服务器)的数据复制到一个或多个MysqL数据库服务器(从服务器)。 认情况下复制是异步的; 从站不需要永久连接以接收来自主站的更新。 根据配置,可以复制数据库中的所有数据库,选定数据库甚至选定的表。

PHP中这样做意味着整个数据库每天或每小时都会被转储,这意味着在转储过程中站点没有响应。 然后你必须通过http传输整个数据库

最后但并非最不重要的是你的PHP方法不允许连续存档。 如果您每天进行一次归档,如果系统在上次备份23:50小时后失败,会发生什么情况?

大佬总结

以上是大佬教程为你收集整理的如何每天从另一台服务器自动加载数据全部内容,希望文章能够帮你解决如何每天从另一台服务器自动加载数据所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: