donglan7594 2011-09-12 09:01
浏览 178

PHP FTP文件上传不起作用

I have pretty strange problem. A web application moved from one server to another one. Since then the FTP upload is not working anymore.

$ftp = ftp_connect('ftphost');
if ($ftp == false) {
    error_log('FTP Connect not possible');
}
$fp = fopen($filename, 'r');
if ($fp == false) {
    error_log('Opening file not possible');
}
$login = ftp_login($ftp, 'username', 'password');

if ($login == false) {
    error_log('FTP login not possible');
}

$status = ftp_fput($ftp, basename($filename), $fp, FTP_BINARY);
if ($status == false) {
    error_log('FTP file upload not possible');
}

The error message is 'FTP file upload not possible'. I checked everything I know of. Selinux is disabled. When I do a FTP upload by hand (on the console with the tool "ftp") it works. The file names are randomly generated and always look like this: erefsdgftef.xml (No spaces.)

This code is part of the last order step within Magento and will therefore always be initiated through the apache httpd.

I don't get more error messages than the one posted before.

Something with the server configuration must be different on the new server. Does someone have more ideas?

  • 写回答

1条回答 默认 最新

  • dqb78642 2011-09-12 09:06
    关注

    Not sure this is your answer but did you already tried to do it in passive mode?

    http://nl3.php.net/manual/en/function.ftp-pasv.php

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题