Doc #54665 [Opn->Csd]: CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented

From: Date: Tue, 30 Jul 2013 03:42:14 +0000
Subject: Doc #54665 [Opn->Csd]: CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10126@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54665&edit=1 ID: 54665 Updated by: yohgaki@php.net Reported by: bhaskarna at yahoo dot com Summary: CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: yohgaki Block user comment: N Private report: N New Comment: According to comment and doc page, this issue is fixed. http://www.php.net/manual/en/curl.constants.php Previous Comments: ------------------------------------------------------------------------ [2012-02-15 14:03:55] joris@php.net I have added the following constants to the CURL documentation: CURLSSH_AUTH_NONE, CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD, CURLSSH_AUTH_DEFAULT, CURLOPT_SSH_AUTH_TYPES, CURLOPT_KEYPASSWD, CURLOPT_SSH_PUBLIC_KEYFILE, CURLOPT_SSH_PRIVATE_KEYFILE and CURLOPT_SSH_HOST_PUBLIC_KEY_MD5. It will take some time for the documentation to be updated with this changes. ------------------------------------------------------------------------ [2011-05-05 09:56:08] bhaskarna at yahoo dot com Prerequisite to run this: please create a text file with name: scp-small-file.txt even i found scp doesn't work but sftp works so, atleast we should document it so that people will not get wondered on - what next after setting "CURLPROTO_SFTP" as the CURLOPT_PROTOCOLS. (Note that, CURLPROTO_SFTP is documented but the respective prerequisites like setting CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE is not documented. ------------------------------------------------------------------------ [2011-05-05 09:50:01] php dot proging at gmail dot com also, when you change to CURLPROTO_SCP: $ diff -u b.php a.php --- b.php 2011-05-05 07:42:56.000000000 +0000 +++ a.php 2011-05-05 07:42:44.000000000 +0000 @@ -6,10 +6,10 @@ $ch = curl_init(); $localfile = 'scp-small-file.txt'; $fp = fopen($localfile, 'r'); - curl_setopt($ch, CURLOPT_URL, 'sftp://@72.246.194.54/21996/'.$localfile); + curl_setopt($ch, CURLOPT_URL, 'scp://@72.246.194.54/21996/'.$localfile); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch,CURLOPT_VERBOSE, 1); - curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); + curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SCP); curl_setopt($ch, CURLOPT_SSH_PUBLIC_KEYFILE, $certPath); curl_setopt($ch, CURLOPT_SSH_PRIVATE_KEYFILE, $keyPath); curl_setopt($ch, CURLOPT_USERPWD,'sshacs'); it doesn't work and throws the following error: * About to connect() to 72.246.194.54 port 22 (#0) * Trying 772.246.194.54... * connected * Connected to t72.246.194.54 (772.246.194.54) port 22 (#0) * SSH authentication methods available: publickey,keyboard-interactive * Using ssh public key file /home/y/conf/yapache/ssh-keys/akamai.id_rsa.pub * Using ssh private key file /home/y/conf/yapache/ssh-keys/akamai.id_rsa * Initialized SSH public key authentication * Authentication complete * SSH CONNECT phase done * scp: '/scp-small-file.txt': No such file or directory * Connection #0 to host 72.246.194.54 left intact * Closing connection #0 File upload error. 79 ------------------------------------------------------------------------ [2011-05-05 09:20:52] bhaskarna at yahoo dot com Description: ------------ CURLOPT_SSH_PUBLIC_KEYFILE and CURLOPT_SSH_PRIVATE_KEYFILE are not documented. They are useful when we require to scp or sftp a file thru curl api. I could achieve successful sftp using above said curl_setopts Test script: --------------- <?php $certPath="/home/y/conf/yapache/ssh-keys/akamai.id_rsa.pub"; $keyPath="/home/y/conf/yapache/ssh-keys/akamai.id_rsa"; error_reporting(E_ALL); ini_set('display_errors', 1); $ch = curl_init(); $localfile = 'scp-small-file.txt'; $fp = fopen($localfile, 'r'); curl_setopt($ch, CURLOPT_URL, 'sftp://@72.246.194.54/21996/'.$localfile); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch,CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); curl_setopt($ch, CURLOPT_SSH_PUBLIC_KEYFILE, $certPath); curl_setopt($ch, CURLOPT_SSH_PRIVATE_KEYFILE, $keyPath); curl_setopt($ch, CURLOPT_USERPWD,'sshacs'); curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile)); curl_exec ($ch); $error_no = curl_errno($ch); curl_close ($ch); if ($error_no == 0) { $error = 'File uploaded succesfully.'; } else { $error = 'File upload error.'; } echo $error.' '.$error_no; ?> * About to connect() to 72.246.194.54 port 22 (#0) * Trying 72.246.194.54... * connected * Connected to 72.246.194.54 (72.246.194.54) port 22 (#0) * SSH authentication methods available: publickey * Using ssh public key file /home/y/conf/yapache/ssh-keys/akamai.id_rsa.pub * Using ssh private key file /home/y/conf/yapache/ssh-keys/akamai.id_rsa * Initialized SSH public key authentication * Authentication complete * Connection #0 to host 72.246.194.54 left intact * Closing connection #0 File uploaded succesfully. 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54665&edit=1

« previous php.doc.bugs (#10126) next »