Segmentation fault (core dumped)


代码很简单,一个demo.php文件中,写了一个curl的函数,后来换成file get contents同样的问题

   
  # php demo.php
  
Segmentation fault (core dumped)

提示Segmentation fault (core dumped)错误

使用gdb调试

   
  (gdb) run demo.php
  
Starting program: /usr/bin/php demo.php
Missing separate debuginfo for /usr/lib/libpng12.so.0
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/9e/65badd636c1f2e81682a8c498af098b5bbd063.debug
Missing separate debuginfo for /usr/lib/libjpeg.so.62
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/05/6b2c6a8cb0b42dda3d57a1b5d3670ab99c83bd.debug
[Thread debugging using libthread_db enabled]
Missing separate debuginfo for /usr/lib64/libldap-2.4.so.2
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/63/ad9b87efd8d1f1af565e4467ebbe80dacc5168.debug
Missing separate debuginfo for /usr/lib64/liblber-2.4.so.2
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/36/4f5fd7aa59ed2af32e0dfc95c4a029b72e4906.debug
[New Thread 0x7ffff0576710 (LWP 17785)]
[Thread 0x7ffff0576710 (LWP 17785) exited]

Program received signal SIGSEGV, Segmentation fault.
0x000000365a01ce9c in sqlite3_file_control () from /usr/lib64/libsqlite3.so.0
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.23-8.el6.x86_64 freetype-2.3.11-14.el6_3.1.x86_64 glibc-2.12-1.7.el6.x86_64 keyutils-libs-1.4-1.el6.x86_64 krb5-libs-1.10.3-10.el6_4.6.x86_64 libcom_err-1.41.12-18.el6.x86_64 libcurl-7.19.7-37.el6_4.x86_64 libgcc-4.4.7-4.el6.x86_64 libidn-1.18-2.el6.x86_64 libselinux-2.0.94-2.el6.x86_64 libssh2-1.4.2-1.el6.x86_64 libstdc++-4.4.7-4.el6.x86_64 libxml2-2.7.6-14.el6.x86_64 nspr-devel-4.10.2-1.el6_5.x86_64 nss-3.15.3-6.el6_5.x86_64 nss-softokn-3.14.3-9.el6.x86_64 nss-softokn-freebl-3.14.3-9.el6.x86_64 nss-sysinit-3.15.3-6.el6_5.x86_64 nss-util-3.15.3-1.el6_5.x86_64 openssl-1.0.1e-16.el6_5.7.x86_64 sqlite-3.6.20-1.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0 0x000000365a01ce9c in sqlite3_file_control () from /usr/lib64/libsqlite3.so.0
#1 0x0000003df0824190 in ?? () from /usr/lib64/libsoftokn3.so
#2 0x0000003df08248e0 in ?? () from /usr/lib64/libsoftokn3.so
#3 0x0000003df0829b76 in ?? () from /usr/lib64/libsoftokn3.so
#4 0x0000003df0810e6b in ?? () from /usr/lib64/libsoftokn3.so
#5 0x0000003df081117e in ?? () from /usr/lib64/libsoftokn3.so
#6 0x0000003df08115a6 in ?? () from /usr/lib64/libsoftokn3.so
#7 0x0000003df0811667 in ?? () from /usr/lib64/libsoftokn3.so
#8 0x0000003df8437457 in ?? () from /usr/lib64/libnss3.so
#9 0x0000003df8437dd7 in ?? () from /usr/lib64/libnss3.so
#10 0x0000003df844b6da in SECMOD_LoadModule () from /usr/lib64/libnss3.so
#11 0x0000003df844b7d0 in SECMOD_LoadModule () from /usr/lib64/libnss3.so
#12 0x0000003df844b7d0 in SECMOD_LoadModule () from /usr/lib64/libnss3.so
#13 0x0000003df841aa94 in ?? () from /usr/lib64/libnss3.so
#14 0x0000003df841b261 in NSS_InitContext () from /usr/lib64/libnss3.so
#15 0x0000003c86640450 in ?? () from /usr/lib64/libcurl.so.4
#16 0x0000003c86640603 in Curl_nss_connect () from /usr/lib64/libcurl.so.4
#17 0x0000003c86638482 in Curl_ssl_connect () from /usr/lib64/libcurl.so.4
#18 0x0000003c86616ecb in Curl_http_connect () from /usr/lib64/libcurl.so.4
#19 0x0000003c8661d682 in Curl_protocol_connect () from /usr/lib64/libcurl.so.4
#20 0x0000003c86623b3c in Curl_connect () from /usr/lib64/libcurl.so.4
#21 0x0000003c8662bbb0 in Curl_perform () from /usr/lib64/libcurl.so.4
#22 0x00000000004b71f2 in zif_curl_exec (ht=<value optimized out>, return_value=0x1046ae0, return_value_ptr=<value optimized out>, this_ptr=<value optimized out>,
return_value_used=<value optimized out>) at /usr/local/src/lnmp1.0-full/php-5.2.17/ext/curl/interface.c:1853
#23 0x0000000000762c70 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffffffbc30) at /usr/local/src/lnmp1.0-full/php-5.2.17/Zend/zend_vm_execute.h:200
#24 0x000000000074f45c in execute (op_array=0x1073030) at /usr/local/src/lnmp1.0-full/php-5.2.17/Zend/zend_vm_execute.h:92
#25 0x00007ffff10cb90f in zend_oe () from /usr/local/zend/ZendOptimizer.so
#26 0x0000000000762626 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffffffbe20) at /usr/local/src/lnmp1.0-full/php-5.2.17/Zend/zend_vm_execute.h:234
#27 0x000000000074f45c in execute (op_array=0x1043728) at /usr/local/src/lnmp1.0-full/php-5.2.17/Zend/zend_vm_execute.h:92
#28 0x00007ffff10cb90f in zend_oe () from /usr/local/zend/ZendOptimizer.so
#29 0x000000000072cc9a in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/lnmp1.0-full/php-5.2.17/Zend/zend.c:1134
#30 0x00000000006ebe9b in php_execute_script (primary_file=0x7fffffffe450) at /usr/local/src/lnmp1.0-full/php-5.2.17/main/main.c:2037
#31 0x000000000079e443 in main (argc=2, argv=0x7fffffffe648) at /usr/local/src/lnmp1.0-full/php-5.2.17/sapi/cli/php_cli.c:1165

提示的这些就看不懂了,
本机的php版本是

   
  # php -v
  
PHP 5.2.17p1 (cli) (built: Mar 8 2014 15:44:43)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

curl版本是

   
  # curl -V
  
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

这个问题要怎么解决?



相关链接

Linux php

堇CAROL 10 years, 1 month ago

http://blog.linuxphp.org/?action=show...
这里说是curl里的一个bug,升级下你的curl版本

别外你的php版本也有点仰慕 ,PHP5.2和PHP5.3相比,PHP5.3改进了很多东西,也优化了很多东西。所以,推荐PHP5.3以上的版本。

Dylan-Z answered 10 years, 1 month ago

Your Answer