运行这个php脚本需要什么php扩展?

运行这个php脚本需要什么php扩展?,php,curl,sftp,Php,Curl,Sftp,由于使用了curl函数,所以一切正常。PHP curl扩展。顺便说一句,您在这里不回显任何内容,您希望得到什么?@mulder无错误日志此脚本不会回显任何内容。正如我所说,当我安装所有东西时,脚本工作正常。那么,问题出在哪里呢?我同意@u_mulder的观点,您需要启用错误报告/错误日志记录。这将帮助您确定所需的扩展名 <?php // ftp URL to file $url = 'sftp site'; // init curl session with FTP address $

由于使用了curl函数,所以一切正常。

PHP curl扩展。

顺便说一句,您在这里不回显任何内容,您希望得到什么?@mulder无错误日志此脚本不会回显任何内容。正如我所说,当我安装所有东西时,脚本工作正常。那么,问题出在哪里呢?我同意@u_mulder的观点,您需要启用错误报告/错误日志记录。这将帮助您确定所需的扩展名
<?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;
}
yum install php-*