My script generates a file that I need php to send via sftp to an ipv6 address.
My first attempts are inconclusive using ssh2_connect() and ssh2_auth_password (). Basically it seems I do not provide a valid $host value.
$host = "[XXXX:XXXX:XX:...]"; // ipv6 enclosed in []
$port = 22;
$user = "XXX";
$pass = "XXXXXXX";
$connection = ssh2_connect($host, $port);
if (ssh2_auth_password($connection, $user, $pass)) {
error_log("valid connection");
} else {
error_log("failed connection");
}
- the error log returns:
PHP Warning: ssh2_connect(): php_network_getaddresses: gethostbyname failed
PHP Warning: ssh2_connect(): Unable to connect to [XXXX:XXXX:XX:...] on port 22...
- Gethostbyname() is invoked and fails. It seems to only support ipv4.
Is there another way to go about this ?
Thank you