I found a discussion of changing the format of the public key at
https://blog.oddbit.com/post/2011-05-08-converting-openssh-public-keys/.
So I used
ssh-keygen -f w.pub -e -m pem
to get a "BEGIN RSA PUBLIC KEY" file from the "ssh-rsa" file.
My program still fails with the same error message.
I also tried reading the key files into strings:
$wpub=file_get_contents("w.pub");
$wkey=file_get_contents("w.key");
if (ssh2_auth_pubkey_file($connection, $user, $wpub, $wkey, $passphrase)) {
And this, too, failed with the same error message.
Why can't ssh2_auth_pubkey_file give more details in its error message?
I'm again running out of free time. Any experts out there?