下面的代码已经运行了一段时间,本周它停止了工作。我将其范围缩小到在“ fopen”语句中失败的行。如果我注释掉fopen行,我会得到正确的回声。起初,我认为这是远程服务器上的权限问题,但是在其他服务器上也发生了同样的事情。

我没有收到错误消息。我基本上得到了一个浏览器消息,该页面无法加载。

它在Ubuntu服务器上的PHP 5.5.9上运行。我们确实在8/11收到了来自ubuntu的许多php软件包的更新。

这是代码:

$connection = ssh2_connect('fe01.xyz.com', 22);
if (!$connection) die('Connection failed');
echo "connected<br>";
$u=ssh2_auth_password($connection, 'username', 'password');
if (!$u) :
   echo "auth failed ";
   exit;
else:
  echo "auth success<br>";
endif;

$outdata=file_get_contents("files/ulti99.csv");
$resSFTP = ssh2_sftp($connection);
if (!$resSFTP):
  echo "SFTP Connection Failed";
  exit;
else:
  echo "SFTP Connection Succuess<br>";
endif;

$resFile = fopen("ssh2.sftp://{$resSFTP}/ulti99.csv", 'w');  // failing
echo "after open";
fwrite($resFile, $outdata );
fclose($resFile);


任何帮助,将不胜感激。

最佳答案

也许您更改了服务器中的文件权限。

关于php - PHP ssh2.sftp停止工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45760802/

10-10 13:57
查看更多