|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73744 ssh2.sftp fopen work with php 7.0.6 ,but not work with 7.0.14.
Submitted: 2016-12-15 04:22 UTC Modified: 2021-02-10 12:17 UTC
Avg. Score:4.5 ± 0.5
Reproduced:11 of 11 (100.0%)
Same Version:9 (81.8%)
Same OS:5 (45.5%)
From: xiaqii at gmail dot com Assigned: cmb (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 7.0.14 OS: ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: xiaqii at gmail dot com
New email:
PHP Version: OS:


 [2016-12-15 04:22 UTC] xiaqii at gmail dot com
this script can work with php 7.0.6 ,but not work with 7.0.14.
my script has run with 7.0.6 for months,when i upgrade to 7.0.14,this script didn't work.
script not change.
os not change.
pecl ssh2 1.0 not change.

Test script:
$conn=ssh2_connect($host, $port);
ssh2_auth_password($conn, $username, $password);
$sftp = ssh2_sftp($conn);
$stream = fopen("ssh2.sftp://{$sftp}{$remote_file}", 'w');

$stream got false with php7.0.14, absolute or relative path both not work.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 13:51 UTC] andreausu+php at gmail dot com
We're having the same issue, it appeared when we upgraded from php 7.0.11 to php 7.0.14
 [2017-01-10 18:26 UTC] oldbucsfan at hotmail dot com
Same problem on Windows Server 2012 R2 and PHP 7.1.0 and 7.0.14. I did find a workaround for now if all you want is to download a file.
$filename = "/folder/filename.pdf";

$connection = ssh2_connect('', 22);
ssh2_auth_password($connection, 'username', 'password');

$tempfilename = tempnam("C:/downloads/", "tmp");
$filetransfered = ssh2_scp_recv($connection, $filename, $tempfilename);


You may also be able to modify that file, then use ssh2_scp_send() to reupload it, changing the file you were attempting to have write access to.
 [2021-02-10 12:17 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-02-10 12:17 UTC]
This problem has been introduced with PHP 7.0.13, and is fixed as
of ssh2 1.1.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Dec 07 02:01:28 2023 UTC