【问题标题】:Server can not accept argument. FTP upload in shell服务器不能接受参数。 shell中的FTP上传
【发布时间】:2013-05-31 20:38:42
【问题描述】:
    $local = 'WP_Inv.csv';
    $remote = 'WP_Inv.csv';
    $user = "User861";
    $pass = "topsecret";
    $host = 'ftp.server.com';
    $port = '21';
    $timeout = '90';
    $type = FTP_ASCII;

    $conn_id = ftp_connect($host,$port,$timeout);

    $login = ftp_login($conn_id, $user, $pass);

             ftp_put($conn_id, $remote, $local, $type);

从 shell 运行时返回以下错误:

最后一行显示错误,任何帮助都会很棒,我正在拔头发!

PHP 警告:ftp_put():服务器不能接受参数。

(是的,我稍后会在代码中关闭我的连接)

【问题讨论】:

    标签: php upload arguments


    【解决方案1】:

    您是否尝试过开启被动模式?我过去也遇到过同样的问题,这是因为运行 php 代码的机器和 ftp 服务器无法在活动连接上握手。

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

    bool ftp_pasv ( resource $ftp_stream , bool $pasv )
    ftp_pasv() turns on or off passive mode. In passive mode, data connections are initiated by the client, rather than by the server. It may be needed if the client is behind firewall.
    
    Please note that ftp_pasv() can only be called after a successfull login or otherwise it will fail.
    

    【讨论】:

    • 就像一个魅力!精彩的!谢谢布鲁斯!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-17
    • 1970-01-01
    • 2015-12-16
    相关资源
    最近更新 更多