<?php
// ftp URL to file
$url = 'sftp site';
// init curl session with FTP address
$ch = curl_init($url);
// specify a callback function for reading data
curl_setopt($ch, CURLOPT_READFUNCTION, 'readCallback');
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SFTP);
// send download headers for client
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="backup.tar.bz2"');
// execute request, our read callback will be called when data is available
curl_exec($ch);
// read callback function, takes 3 params, the curl handle, the stream to read from and the maximum number of bytes to read
function readCallback($curl, $stream, $maxRead)
{
// read the data from the ftp stream
$read = fgets($stream, $maxRead);
// echo the contents just read to the client which contributes to their total download
echo $read;
// return the read data so the function continues to operate
return $read;
}
, когда я просто установить PHP-завиток, Libcurl и локон, возвращается сценарий и пустой файл , но, когда я установить все, что есть на ни репокакое расширение php необходимо для запуска этого скрипта php?
yum install php-*
все работает отлично
Прочитать журналы ошибок. –
Btw, вы ничего здесь не отзываете, чего вы ожидаете? –
@mulder нет журналов ошибок –