Edit report at https://bugs.php.net/bug.php?id=63766&edit=1
ID: 63766 Updated by: paj...@php.net Reported by: mattsch at gmail dot com Summary: sftp upload CURLOPT_URL errors with code 79 with directory path -Status: Open +Status: Not a bug Type: Bug Package: cURL related Operating System: Gentoo PHP Version: 5.4.9 Block user comment: N Private report: N New Comment: CURL cannot upload directory (aka recursively). However it can create missing directories in a path if necessary using the create dir option. Previous Comments: ------------------------------------------------------------------------ [2012-12-14 06:55:24] mattsch at gmail dot com Description: ------------ When specifying a url in CURLOPT_URL with a directory path only using the sftp protocol, the upload will always fail with error code 79 (An unspecified error occurred during the SSH session). If you change the CURLOPT_URL to be the same path but add a filename at the end of the directory path, the upload will succeed. emerge -pv php:5.4 These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ~] dev-lang/php-5.4.9:5.4 USE="apache2 bcmath bzip2 calendar cjk cli crypt ctype curl curlwrappers exif fileinfo filter ftp gd gdbm gmp hash iconv ipv6 json ldap mhash mysql mysqli mysqlnd nls pcntl pdo phar posix readline session simplexml snmp soap sockets spell sqlite ssl sysvipc threads tidy tokenizer truetype unicode wddx xml xmlwriter xpm xsl zip zlib -berkdb -cdb -cgi -debug -doc -embed -enchant -firebird -flatfile -fpm (-frontbase) -imap -inifile -intl -iodbc -kerberos (-kolab) -ldap-sasl -libedit -mssql -oci8-instant-client -odbc -pic -postgres -qdbm -recode (-selinux) -sharedmem (-sybase-ct) -xmlreader -xmlrpc" 0 kB emerge -pv curl These are the packages that would be merged, in order: Calculating dependencies e - ... done! [ebuild R ~] net-misc/curl-7.28.1 USE="idn ipv6 nonblocking ssh ssl threads -adns -kerberos -ldap -metalink -rtmp -static-libs {-test}" CURL_SSL="openssl -axtls -cyassl -gnutls -nss -polarssl" 0 kB emerge -pv libssh2 These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ~] net-libs/libssh2-1.4.3 USE="zlib -gcrypt -static-libs {-test}" 0 kB curl -V curl 7.28.1 (x86_64-pc-linux-gnu) libcurl/7.28.1 OpenSSL/1.0.0j zlib/1.2.7 libidn/1.25 libssh2/1.4.3 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz Test script: --------------- <?php function upload($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch, CURLOPT_INFILE, fopen('/tmp/foo', 'r')); curl_setopt($ch, CURLOPT_INFILESIZE, filesize('/tmp/foo')); curl_setopt($ch, CURLOPT_USERPWD, 'user:password'); curl_exec($ch); echo curl_errno($ch) . "\n"; } // prints 79 -- should print 0 upload('sftp://domain.tld:/tmp'); // prints 0 upload('sftp://domain.tld:/tmp/foo'); Expected result: ---------------- 0 0 Actual result: -------------- 79 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63766&edit=1