Re: Hoping for a working example of SFTP in PHP

From: Date: Mon, 01 Feb 2021 18:25:22 +0000
Subject: Re: Hoping for a working example of SFTP in PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-327430@lists.php.net to get a copy of this message
This is a reply to: 1/29/2021 1:12 PM, Jose Nobile Can anyone help me? My version of your code, adapted for Windows and cPanel, is as follows: $connection = ssh2_connect($hostDomainName, $securePort, array('hostkey'=>'ssh-rsa')); echo "ssh2_connect: $connection"; if (ssh2_auth_pubkey_file($connection, $user,
                          "x.crt",
                          "x.key", $passphrase)) {
echo "Public Key Authentication Successful\n"; $sftp = ssh2_sftp($connection); } else { die('Public Key Authentication Failed'); } Running this code produces an error: "Starting... ssh2_connect: Resource id #4 Warning: ssh2_auth_pubkey_file(): Authentication failed for nsr using public key: Unable to open public key file in C:\Dropbox\Private\Web\nsr-HMAC\upload\upload.php on line 39 Public Key Authentication Failed" File x.crt begins: -----BEGIN CERTIFICATE----- File x.key begins: "-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED" Can anyone help me? David Spector Springtime Software

« previous php.general (#327430) next »