I have a long running PHP script that is synching two systems and using SSH2 to upload files to a Server. The script is executed using a cronjob.
My problem is, that the script just terminates (sometimes after 1 hour, sometimes after two hours) without any output. I couldn't find anything in PHP's error logs, nor in the systemlogs. This happens equally on three separate machines.
Basically this is my code (please imaging error handling etc. included) for the upload:
$oFtpStream = fopen('ssh2.sftp://' . $this->sUser . ':' . $this->sPassword . '@' .$this->sHost . ':' . $this->iPort . $psTargetFile, 'w');
$sFileContents = file_get_contents($psSourceFile);
fwrite($oFtpStream, $sFileContents) === false)
fclose($oFtpStream);
ssh2_sftp_chmod($this->oFtpConn, $psTargetFile, 0777);
I would be really thankfull for any thoughts/ideas.
Thanks in advance!