【发布时间】:2020-03-01 02:27:30
【问题描述】:
我无法使用 PHP 通过 pem 文件连接到 Amazon EC2
$pemFile = file_get_contents($this->_pemFileLocation);
$out = "";
$key_private = openssl_pkey_export($pemFile, $out);
我需要连接并获取从ssh2_auth_pubkey_file() 返回的连接对象,因此我可以在 Amazon EC2 实例或使用 pem 文件的任何其他服务器上运行终端命令。
【问题讨论】:
-
我之前已经放弃了这样的任务,最终改用了 exec(
ssh -t)。虽然这绝对不是您所期望的解决方案,但它可以暂时用作临时解决方法。
标签: php amazon-ec2 ssh