cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Segmentation fault when using CURLOPT_SSLCERT,

From: Mike R <jobs4mike_at_yahoo.com>
Date: Sat, 17 Nov 2007 07:43:36 -0800 (PST)

I have a problem with php/curl when using sslcert option.
Without CURLOPT_SSLCERT everything works fine, as soon as i enable it I get a segmentation fault.
Here is my page:
<?php $a = curl_version();
 print_r($a);

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://secure.linkpt.net:1129/LSGSXML");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "");
curl_setopt ($ch, CURLOPT_SSLCERT, "/tmp/key");
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_VERBOSE, 1);

// grab URL and pass it to the browser
$result = curl_exec($ch);
print_r($result);

phpinfo(); ?>

when i run it from command line I get:
 Array
(
    [version_number] => 463105
    [age] => 3
    [features] => 1565
    [ssl_version_number] => 0
    [version] => 7.17.1
    [host] => i686-pc-linux-gnu
    [ssl_version] => OpenSSL/0.9.7a
    [libz_version] => 1.2.3
    [protocols] => Array
        (
            [0] => tftp
            [1] => ftp
            [2] => telnet
            [3] => dict
            [4] => http
            [5] => file
            [6] => https
            [7] => ftps
        )

)
* About to connect() to secure.linkpt.net port 1129 (#0)
* Trying 216.66.211.227... * connected
* Connected to secure.linkpt.net (216.66.211.227) port 1129 (#0)
Segmentation fault

in a truss output the last few lines read
:20651 read(4, "-----BEGIN RSA PRIVATE KEY-----\n"..., 4096) = 1819
20651 read(4, "", 4096) = 0
20651 close(4) = 0
20651 munmap(0xb7d96000, 4096) = 0
20651 open("/tmp/key", O_RDONLY) = 4
20651 fstat64(4, {st_mode=S_IFREG|0644, st_size=1819, ...}) = 0
20651 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d96000
20651 read(4, "-----BEGIN RSA PRIVATE KEY-----\n"..., 4096) = 1819
20651 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
20651 +++ killed by SIGSEGV +++

This only happens on my production machine.
When trying to reproduce the issue in development everything works just fine.
I tried a few different versions of php and curl and now run the latest: php-5.2.5m curl 7.17.1

I am guessing it's one of the libraries.. but i can't figure out which one.

Mike.

      ____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-11-17