Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Curl错误代码25_Php_Curl_Ftp_Egnyte - Fatal编程技术网

PHP Curl错误代码25

PHP Curl错误代码25,php,curl,ftp,egnyte,Php,Curl,Ftp,Egnyte,我试着在网上搜索,但是我找不到一个关于这个问题的清晰的观点 我有一种情况,上传的文件将通过FTP Egnyte发送到另一台服务器。我有一个localhost设置,它成功地将文件上传到FTP,但没有在实时站点中,它给我一个curl错误25-在FTP中,STOR命令被拒绝。它还有一条FTP上传失败的错误消息:451。更让我头疼的是,服务器从活动站点克隆了staging/dev,并且在那里工作得非常好 在本地主机设置中,我应该在live站点的服务器中查找哪些内容和/或curl错误的可能原因?顺便说一句

我试着在网上搜索,但是我找不到一个关于这个问题的清晰的观点

我有一种情况,上传的文件将通过FTP Egnyte发送到另一台服务器。我有一个localhost设置,它成功地将文件上传到FTP,但没有在实时站点中,它给我一个curl错误25-在FTP中,STOR命令被拒绝。它还有一条FTP上传失败的错误消息:451。更让我头疼的是,服务器从活动站点克隆了staging/dev,并且在那里工作得非常好

在本地主机设置中,我应该在live站点的服务器中查找哪些内容和/或curl错误的可能原因?顺便说一句,在实时服务器中启用了Curl

考虑变量的My curl选项已正确提供,ftp已连接:

// connection options
    $options = array(
        CURLOPT_USERPWD        => $username . ':' . $password,
        CURLOPT_SSL_VERIFYPEER => false, // don't verify SSL
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_FTP_SSL        => CURLFTPSSL_ALL, // require SSL For both control and data connections
        CURLOPT_FTPSSLAUTH     => CURLFTPAUTH_DEFAULT, // let cURL choose the FTP authentication method (either SSL or TLS)
        CURLOPT_UPLOAD         => true,
        CURLOPT_PORT           => $port,
        CURLOPT_TIMEOUT        => 30,
    );
这是我的上传功能:

public function upload( $file_name, $file ) {

    // set file name
    if ( ! curl_setopt( $this->curl_handle, CURLOPT_URL, $this->url . $file_name ))
        throw new Exception ( "Could not set cURL file name: $file_name" );

    /* Open the file for writing  */
    $file_stream = fopen($file, "r");

    /* Open a memory for writing */
    $stream = fopen('php://temp' , "wb");

    /* Read the file and write it to the stream 1kb at a time */
    while ($data = fread($file_stream, 1024))
        fwrite($stream, $data);

    // rewind the stream pointer
    rewind( $stream );

    // set the file to be uploaded
    if ( ! curl_setopt( $this->curl_handle, CURLOPT_INFILE, $stream ) )
        throw new Exception( "Could not load file $file_name" );

    // upload file
    if ( ! curl_exec( $this->curl_handle ) ) {
        throw new Exception( sprintf( 'Could not upload file. cURL Error: [%s] - %s', curl_errno( $this->curl_handle ), curl_error( $this->curl_handle ) ) );
    }

    // close the stream handle
    fclose( $stream );
    fclose( $file_stream );
}

事实上,我在两周前就发现了这个问题

在实时站点中,如果文件名中有空格,则会失败。现在,用下划线替换空格应该是好的。我还不确定为什么在本地主机设置中集成脚本时,使用空格是非常好的