致命错误:调用未定义的函数ftp_ssl_connect() [英] Fatal error: Call to undefined function ftp_ssl_connect()

查看:774
本文介绍了致命错误:调用未定义的函数ftp_ssl_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在PHP中设置FTP SSL连接。我已经使用 ftp_connect()很好,并且效果很好。只要我尝试使用 ftp_ssl_connect(),就会出现此错误:


致命错误:调用未定义函数ftp_ssl_connect()

我在PHP扩展中打开了openssl扩展。我不知道还有什么要做的搜索谷歌没有什么,我可以找到做这个函数调用工作。有没有人知道我什么时候缺少的东西,或者检查是否需要在我的wampserver上安装其他东西?



这是我使用的php代码:

  $ conn_id = ftp_ssl_connect($ ftp_server); 
$ ftp_user_name =用户名;
$ ftp_user_pass =密码;
$ login_result = ftp_login($ conn_id,$ ftp_user_name,$ ftp_user_pass);

ftp_pasv($ conn_id,true);如果((!$ conn_id)||(!$ login_result)){
echoFTP连接失败!
echo尝试连接到用户$ ftp_user_name的$ ftp_server;
出口;
} else {
echo连接到$ ftp_server,用户$ ftp_user_name;
}

显然不会超过第一行,因为 ftp_ssl_connect()是一个未定义的函数。 PHP解析方案

文档
$ b


注意:为什么这个函数可能不存在
ftp_ssl_connect()只有在ftp模块和OpenSSL支持是静态构建到php中的,这意味着在Windows上,这个函数在官方的PHP构建中是未定义的。注意:
ftp_ssl_connect()不适用于sFTP
/ strong>即可。要在PHP中使用sFTP,请参阅 ssh2_sftp()

(顺便说一句:我不使用Windows,但无法访问 ftp_ssl_connect()


I am trying to set up FTP SSL connection in PHP. I have used ftp_connect() fine and works great. As soon as I try to use ftp_ssl_connect(), I get this error:

Fatal error: Call to undefined function ftp_ssl_connect()

I do have openssl extension turned on in PHP extentions. I am not sure what else there is to do as searching google there is nothing that I can find to do to make this function call work. Does anyone know when what I am missing or to check to see if something else needs to be installed on my wampserver?

Here is my php code I am using:

$conn_id = ftp_ssl_connect($ftp_server); 
$ftp_user_name = "username"; 
$ftp_user_pass = "password"; 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

ftp_pasv($conn_id, true); 
if ((!$conn_id) || (!$login_result)) { 
    echo "FTP connection has failed!"; 
    echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
    exit; 
} else { 
    echo "Connected to $ftp_server, for user $ftp_user_name"; 
}

It obviously doesn't get past the first line because of saying that ftp_ssl_connect() is an undefined function.

解决方案

From PHP Documentation:

Note: Why this function may not exist ftp_ssl_connect() is only available if both the ftp module and the OpenSSL support is built statically into php, this means that on Windows this function will be undefined in the official PHP builds. To make this function available on Windows you must compile your own PHP binaries.

Note: ftp_ssl_connect() is not intended for use with sFTP. To use sFTP with PHP, please see ssh2_sftp().

(BTW: I don't use Windows but I can't access to ftp_ssl_connect())

这篇关于致命错误:调用未定义的函数ftp_ssl_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆