FTPS PHP活动保护程序

FTPS PHP活动保护程序,php,ssl,curl,ftps,Php,Ssl,Curl,Ftps,我正在尝试在ftp空间上传一个包含ssl的文件 我连接它来上传它提示保护程序的文件 我环顾四周,但找不到任何关于如何激活它的信息。 你知道帮助我吗 我留给你我的代码和它的冗长 $file = "prova_4u.csv"; $ftp_server="mio ftps"; $ftp_user_name="mio user"; $ftp_user_pass="mia pass"; $path="/"; //$file =dirname(__FILE__)."/../application/

我正在尝试在ftp空间上传一个包含ssl的文件

我连接它来上传它提示保护程序的文件

我环顾四周,但找不到任何关于如何激活它的信息。 你知道帮助我吗

我留给你我的代码和它的冗长

$file = "prova_4u.csv";

$ftp_server="mio ftps";  
$ftp_user_name="mio user";
$ftp_user_pass="mia pass"; 
$path="/"; 
//$file =dirname(__FILE__)."/../application/archivosastras/".$localfile.".csv";
$remote_file = $path.$file; 
$ch = curl_init(); 
$fp = fopen($file,'r');

curl_setopt($ch, CURLOPT_URL, $ftp_server.$remote_file);
curl_setopt($ch, CURLOPT_UPLOAD, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1);  
curl_setopt($ch, CURLOPT_INFILE, $fp); 
curl_setopt($ch, CURLOPT_PORT, 990);

//SSL stuff curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

//curl_setopt($ch, CURLOPT_USE_SSL, TRUE); 
curl_setopt($ch, CURLOPT_FTP_SSL, CURLOPT_FTPSSLAUTH); 
curl_setopt($ch, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS); 
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FTPS); 
curl_setopt($ch, CURLOPT_USERPWD,"$ftp_user_name:$ftp_user_pass");   
//curl_setopt($ch,CURLOPT_SSLVERSION, 3);

//end SSL curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file)); 
$exec = curl_exec ($ch);

echo "\n\r".$exec."\n\r";

$error_no = curl_errno($ch); $error_msg = curl_error($ch);

echo "no - ".$error_no." - ".$error_msg."\n\r\n\r";

curl_close ($ch);

if ($error_no == 0) {   $error = 'File uploaded succesfully.'; } else {
    $error = 'File upload error.'; }

echo "\n\r".$error."\n\r";

fclose($fp);
详细输出

About to connect() to *********** port 990
*   Trying * * * * * * * *... * connected
* Connected to * * * * * * (* * * * * * * *) port 990
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt   CApath: none
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*    subject: /CN=*****/C=IT/ST=Italy/L=Milan/O=***/OU=ICT/emailAddress=*****
*    start date: 2015-09-04 15:42:55 GMT
*    expire date: 2016-09-03 15:42:55 GMT
*    issuer: /CN=*****/C=IT/ST=Italy/L=Milan/O=****/OU=ICT/emailAddress=info@assistenzacasa.com
* SSL certificate verify result: self signed certificate (18), continuing anyway. < 220-Welcom to "******" FTP over TLS
service. < 220 Access by unauthorized users is prohibited and may be
prosecuted.
> USER **** < 331 Password required for ***
> PASS ****** < 230 Logged on
> PBSZ 0 < 200 PBSZ=0
> PWD < 257 "/" is current directory.
* Entry path is '/'
> EPSV
* Connect data stream passively < 229 Entering Extended Passive Mode (|||50000|)
*   Trying *****... * connected
* Connecting to ****** (******) port 50000
> TYPE I < 200 Type set to I
> STOR prova_4u.csv < 521 PROT P required
* Failed FTP upload: 521
* Uploaded unaligned file size (0 out of 21 bytes)
* Connection #0 to host **** left intact


no - 25 - Failed FTP upload: 521

* Closing connection #0

File upload error.
即将()连接到**********端口990
*正在尝试******……*有联系的
*已连接到******(******)端口990
*已成功设置证书验证位置:
*CAfile:/etc/pki/tls/certs/ca-bundle.crt CApath:无
*使用DHE-RSA-AES256-SHA的SSL连接
*服务器证书:
*主题:/CN=******/C=IT/ST=Italy/L=Milan/O=***/OU=ICT/emailAddress=*****
*开始日期:2015-09-04 15:42:55 GMT
*过期日期:2016-09-03 15:42:55 GMT
*发卡机构:/CN=******/C=IT/ST=Italy/L=Milan/O=***/OU=ICT/emailAddress=info@assistenzacasa.com
*SSL证书验证结果:自签名证书(18),仍在继续220 Welcom通过TLS发送至“******”FTP
服务220禁止未经授权的用户访问,并且可能
起诉。
>用户****<331密码,用于***
>通过******<230登录
>PBSZ 0<200 PBSZ=0
>PWD<257“/”是当前目录。
*输入路径为“/”
>EPSV
*被动连接数据流<229进入扩展被动模式(| | | | 50000 |)
*正在尝试******……*有联系的
*连接到******(*******)端口50000
>I型<200型设置为I型
>STOR prova_4u.csv<需要521保护
*FTP上载失败:521
*上载的未对齐文件大小(21个字节中的0个)
*与主机****的连接#0保持完好
否-25-FTP上载失败:521
*正在关闭连接#0
文件上载错误。

谢谢

下次请格式化您的代码,使其看起来更合理。
$ftp\u服务器的协议部分是什么?如果是
ftps://
,请尝试将其更改为
ftp://
。(请参阅)我需要一个ssl隐式而非显式的ssl,下次请格式化您的代码,使其看起来更合理
$ftp\u server
的协议部分是什么?如果是
ftps://
,请尝试将其更改为
ftp://
。(请参阅)我需要一个ssl隐式,而不是在您的链接显式