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

curl-and-php

PHP CLI segfault using curl for https

From: Martin McConnell <martin_at_rsm2000.co.uk>
Date: Fri, 22 Jun 2007 18:13:18 +0100

Hi,

Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7a PHP/5.2.0

# uname -a
Linux rsm2.rsmsecure.com 2.6.9-55.ELsmp #1 SMP Wed May 2 14:04:42 EDT 2007
x86_64 x86_64 x86_64 GNU/Linux

# curl -V
curl 7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a
zlib/1.2.1.2 libidn/0.5.6
Protocols: ftp gopher telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

PHP configure command:
'./configure'
'--with-mysql=/usr/local/src/mysql-max-5.0.27-linux-x86_64-glibc23'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-exif' '--with-mcrypt'
'--with-zlib-dir' '--with-freetype-dir' '--with-mime-magic'
'--with-curl=/usr' '--with-curlwrappers' '--disable-cgi' '--enable-debug'

I'm having problems using curl functions within php for https addresses, but
only when using the PHP CLI from the command line, it works fine through a
browser. It also works fine on another server which as far as I can work
out has been installed the same way.

To rule out a problem with my code (which works fine on the other similar
server) I tried just the simple get example from the curl site, except I
changed it to get phpinfo.php from my own server. Here's gdb backtrace when
I tried with https (again it worked fine with http).

</div></body></html>*** glibc detected *** free(): invalid pointer:
0x0000003eccf31b78 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread 182896548096 (LWP 29216)]
0x0000003eccd2e21d in raise () from /lib64/tls/libc.so.6
(gdb) bt
#0 0x0000003eccd2e21d in raise () from /lib64/tls/libc.so.6
#1 0x0000003eccd2fa1e in abort () from /lib64/tls/libc.so.6
#2 0x0000003eccd63451 in __libc_message () from /lib64/tls/libc.so.6
#3 0x0000003eccd6906e in _int_free () from /lib64/tls/libc.so.6
#4 0x0000003eccd693b6 in free () from /lib64/tls/libc.so.6
#5 0x0000003d2294d8f9 in CRYPTO_free () from /lib64/libcrypto.so.4
#6 0x0000003d229b2d67 in ASN1_STRING_free () from /lib64/libcrypto.so.4
#7 0x0000003d229accff in ASN1_primitive_free () from /lib64/libcrypto.so.4
#8 0x0000003d229acd4c in ASN1_primitive_free () from /lib64/libcrypto.so.4
#9 0x0000003d229ad0b7 in ASN1_template_free () from /lib64/libcrypto.so.4
#10 0x0000003d229acfd1 in ASN1_primitive_free () from /lib64/libcrypto.so.4
#11 0x0000003d229ad0b7 in ASN1_template_free () from /lib64/libcrypto.so.4
#12 0x0000003d229acfd1 in ASN1_primitive_free () from /lib64/libcrypto.so.4
#13 0x0000003d229ad0f2 in ASN1_item_free () from /lib64/libcrypto.so.4
#14 0x0000003d22995833 in sk_pop_free () from /lib64/libcrypto.so.4
#15 0x0000003d2272373f in ssl_sess_cert_free () from /lib64/libssl.so.4
#16 0x0000003d2272427f in SSL_SESSION_free () from /lib64/libssl.so.4
#17 0x0000003d227224f9 in SSL_free () from /lib64/libssl.so.4
#18 0x0000003d22c1b34f in Curl_SSL_Close () from /usr/lib64/libcurl.so.3
#19 0x0000003d22c146fd in Curl_disconnect () from /usr/lib64/libcurl.so.3
#20 0x0000003d22c163d8 in Curl_setopt () from /usr/lib64/libcurl.so.3
#21 0x0000003d22c16418 in Curl_close () from /usr/lib64/libcurl.so.3
#22 0x00000000004a1eb9 in _php_curl_close (rsrc=0x2a9865d808) at
/usr/local/src/php/ext/curl/interface.c:1901
#23 0x0000000000728ad1 in list_entry_destructor (ptr=0x2a9865d808) at
/usr/local/src/php/Zend/zend_list.c:184
#24 0x0000000000726124 in zend_hash_del_key_or_index (ht=0xb7f188,
arKey=0x0, nKeyLength=0, h=4, flag=1)
    at /usr/local/src/php/Zend/zend_hash.c:492
#25 0x00000000007285c6 in _zend_list_delete (id=4) at
/usr/local/src/php/Zend/zend_list.c:58
#26 0x00000000004a1e90 in zif_curl_close (ht=1, return_value=0x2a9865a468,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /usr/local/src/php/ext/curl/interface.c:1886
#27 0x000000000073f7c2 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fbfffd050) at /usr/local/src/php/Zend/zend_vm_execute.h:200
#28 0x0000000000745407 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0x7fbfffd050) at
/usr/local/src/php/Zend/zend_vm_execute.h:1681
#29 0x000000000073f25a in execute (op_array=0x2a9865b0d0) at
/usr/local/src/php/Zend/zend_vm_execute.h:92
#30 0x0000000000719919 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/local/src/php/Zend/zend.c:1097
#31 0x00000000006c0a56 in php_execute_script (primary_file=0x7fbffff7d0) at
/usr/local/src/php/main/main.c:1758
#32 0x000000000079227a in main (argc=2, argv=0x7fbffff928) at
/usr/local/src/php/sapi/cli/php_cli.c:1108

The server is running Centos4 and was updated via yum. I've tried
reinstalling the rpms for openssl & curl and then doing a recompile of
apache & php, but this hasn't made any difference.

If anyone could give me some pointers as to what to try next or where to
look for clues I'd be very grateful as I'm now out of my depth. If I've
missed any info out let me know.

Cheers,

Martin

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-06-22