做一个推广网站多少钱bt磁力链好用的引擎
我一直在尝试制作一些脚本,通过FTP从我在CentOS的localhost Apache下载文件,我无法让它工作!
我使用的代码是任何基本ftp请求使用的代码:
$ip= FTP_IP_HERE;
$port='21';
$timeout='90';
$un='username';
$pw='password';
// Connect to ftp
$conn_id = ftp_connect($ip,$port,$timeout);
// Open a session to an external ftp site
$login_result = ftp_login ($conn_id, $un, $pw);
// Check open
if ((!$conn_id) || (!$login_result)) {
print "FTP connection failed!";
exit();
}
// turn on passive mode transfers
if (ftp_pasv($conn_id, true) == FALSE) {
print "Passive FTP connection failed!";
exit();
}
我在远程服务器上尝试了相同的脚本,它工作正常!
我不确定是否要进行任何apache配置,或者本身是否有PHP限制.
更新:
这是错误日志:
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /var/www/html/ftp/FTP.php on line 16
Warning: ftp_get() expects parameter 1 to be resource, boolean given in /var/www/html/ftp/FTP.php on line 22
Falha ao enviar o arquivo test.pdf
Array
(
[type] => 2
[message] => ftp_get() expects parameter 1 to be resource, boolean given
[file] => /var/www/html/ftp/FTP.php
[line] => 22
)
Warning: ftp_close() expects parameter 1 to be resource, boolean given in /var/www/html/ftp/FTP.php on line 30