Re: Hoping for a working example of SFTP in PHP

From: Date: Mon, 01 Feb 2021 18:41:29 +0000
Subject: Re: Hoping for a working example of SFTP in PHP
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-327432@lists.php.net to get a copy of this message
David, This might be easier to get an answer to on stackoverflow or similar sites :) where you can showcase your whole file instead of a subset. The error message is quite specific: Unable to open public key file in
C:\Dropbox\Private\Web\nsr-HMAC\upload\upload.php on line 39
It might be worth starting out to check that line and go from there :). --- Best Regards / Med Venlig Hilsen Kasper Sanguesa-Franz On 2021-02-01 18:25, David Spector wrote:
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 (#327432) next »