2016-01-29 16 views
1

我試圖在PHP中設置FTP SSL連接。我用ftp_connect()罰款和偉大的作品。當我嘗試使用ftp_ssl_connect(),我得到這個錯誤:致命錯誤:調用未定義的函數ftp_ssl_connect()

Fatal error: Call to undefined function ftp_ssl_connect()

我有OpenSSL的擴展在PHP中的一些推廣打開。我不知道還有什麼要做的搜索谷歌沒有什麼,我可以找到做這個函數調用工作。有沒有人知道我什麼時候缺少的東西,或者檢查是否需要在我的wampserver上安裝其他東西?

這是我的PHP代碼我使用:

$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"; 
} 

它顯然沒有得到過去的第一線,因爲說ftp_ssl_connect()是未定義功能。

回答

4

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() .

(順便說一句:我不使用Windows,但我不能訪問到ftp_ssl_connect()

+0

好吧,我要試試這個。 – NickC217

相關問題