简体   繁体   English

PHP ftp_get下载零字节文件

[英]PHP ftp_get download zero bytes files

in a PHP project, I need to download CSV files from a FTP server. 在一个PHP项目中,我需要从FTP服务器下载CSV文件。 I'm using PHP ftp_XXX function to do this. 我正在使用PHP ftp_XXX函数来执行此操作。

I'm working on two separate computers, one can download FTP files with no problem; 我在两台不同的计算机上工作,一台可以毫无问题地下载FTP文件。 the other one initiate the FTP connection, open and create a file on my disk but after a few seconds (sounds like a timeout), the script end with this error: 另一个启动FTP连接,打开并在磁盘上创建一个文件,但是几秒钟后(听起来像是超时),脚本以以下错误结束:

PHP Warning:  ftp_get(): Opening BINARY mode data connection for...

I've already tried to use passive mode, the connection is closed at the end of my script and the strange thing is that this is working on another computer, and on my server. 我已经尝试使用被动模式,该连接在脚本结尾处关闭,奇怪的是,该连接正在另一台计算机和服务器上运行。

So here are my questions: 1) do you have any idea why this is happening? 所以这是我的问题:1)您是否知道为什么会这样? 2) are there configuration in php.ini or apache to enable properly PHP FTP? 2)是否在php.ini或apache中进行配置以正确启用PHP FTP?

Thanks you. 谢谢。

Cyril 西里尔

Maybe you exceeded maximum execution time. 也许您超出了最大执行时间。 Try to increase it: http://php.net/manual/en/function.set-time-limit.php 尝试增加它: http : //php.net/manual/en/function.set-time-limit.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM