php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52513 cURL SSL call with client cert fails if within a class
Submitted: 2010-08-02 11:28 UTC Modified: 2011-09-08 14:47 UTC
From: diego_gullo at bizmate dot biz Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.14 OS: Linux version 2.6.16-xenU
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: diego_gullo at bizmate dot biz
New email:
PHP Version: OS:

 

 [2010-08-02 11:28 UTC] diego_gullo at bizmate dot biz
Description:
------------
When using cURL to send an HTTP post through a SSL connection that required a 
client certificate it works fine if run straight from the script, outside a 
class. 
However when the same code is executed from within a class for some reason I get 
a private key error that makes no sense since the certificate, private key, 
password and all the cURL options used to connect are executed exactly the same 
way with references to the same files.

Exact version of PHP is 5.2.11
curl->libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 

compile line
'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--
target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-
prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--
datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--
libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--
mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-
file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--
with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-
rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '-
-with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--
without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-
dir=/usr' '--with-openssl' '--with-png' '--with-expat-dir=/usr' '--with-pcre-
regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--
enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '-
-enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--
enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-
unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-
calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-
sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--enable-
force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--
enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-
ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' '--enable-
dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--
with-ldap-sasl' '--with-mysql=shared,/usr' '--with-
mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-dom-
xslt=/usr' '--with-dom-exslt=/usr' '--with-pgsql=shared' '--with-
snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-
xmlreader=shared' '--enable-xmlwriter=shared' '--enable-fastcgi' '--enable-
pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-
mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-
sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-
readline' '--enable-dbase=shared' '--with-pspell=shared' '--with-
mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-tidy=shared,/usr' '--
with-mssql=shared,/usr' 

Test script:
---------------
i have created two short files that show the difference in usage that is the only difference i can see, available at

http://bizmatebiz.dreamhosters.com/curl_bug_bizmate.zip

Expected result:
----------------
response from the API whose endpoint is specified in the script

Actual result:
--------------
Error: unable to set private key file: '/home/USER/certs/my.pem' type PEM
bool(false) 

Patches

curl_SSL_privateKeyFail_in_Function (last revision 2010-08-02 09:41 UTC by diego_gullo at bizmate dot biz)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-20 12:06 UTC] jani@php.net
-Package: Tidy +Package: cURL related
 [2011-09-08 14:47 UTC] bjori@php.net
-Status: Open +Status: Bogus
 [2011-09-08 14:47 UTC] bjori@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

It works fine.
I am guessing your class is in a different dir when you are trying this, hence 
not actually referecing the correct file.
Use full path.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC