Reputation: 309
I trying to install the php_ssh2.dll extension on a
for ssh2_connect() ... i want to open a sftp connection
1.) I toke the libssh2.dll
into /System32
and /syswow64
folder
2.) the php_ssh2.dll
and php_ssh2.pdb
into /xampp/php/ext
folder
3.) modified php.ini
(add extension=php_ssh2.dll
)
4.) restarted Apache
I start my example script an result:
Fatal error: Call to undefined function ssh2_connect()
Now, I'm not sure how I can solve this issue, maybe someone has any idea?
Upvotes: 1
Views: 4278
Reputation: 309
I tested a lot the last few hours.
Update to php 7.1,
used some other versions of php_ssh2.dll
/ libssh2.dll
, tried to install the dll on Windows by Powershell (regsvr32.exe) ... nothing works with ssh2_connect($ftp_server, 22);
!But I found a other solution by using curl()
here is my example (it works!)
<?php
$ftp_server = 'xxx'; $ftp_user_name = 'xxx'; $ftp_user_pass = 'xxx';
$c = curl_init("sftp://$ftp_user_name:$ftp_user_pass@$ftp_server/folder/file.xxx");
curl_setopt($c, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); $data =
curl_exec($c); curl_close($c);
if ($data === false){echo 'err';}else{echo 'done';}
?>
Upvotes: 3