root@testphp:~# valgrind php test.php ==3716== Memcheck, a memory error detector ==3716== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==3716== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==3716== Command: php test.php ==3716== ==3716== Warning: invalid file descriptor -1 in syscall close() ==3716== Jump to the invalid address stated on the next line ==3716== at 0xEE7CDB0: ??? ==3716== by 0x53437AE: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x5341B75: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x535125F: sk_pop_free (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x5341EFB: ENGINE_cleanup (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x7BB64CD: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7BB6E68: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7B926B4: curl_global_cleanup (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7959C97: zm_shutdown_curl (in /usr/lib/php5/20121212/curl.so) ==3716== by 0x6F4692: module_destructor (in /usr/bin/php5) ==3716== by 0x6F9904: ??? (in /usr/bin/php5) ==3716== by 0x6FB107: zend_hash_graceful_reverse_destroy (in /usr/bin/php5) ==3716== Address 0xee7cdb0 is not stack'd, malloc'd or (recently) free'd ==3716== ==3716== ==3716== Process terminating with default action of signal 11 (SIGSEGV) ==3716== Access not within mapped region at address 0xEE7CDB0 ==3716== at 0xEE7CDB0: ??? ==3716== by 0x53437AE: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x5341B75: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x535125F: sk_pop_free (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x5341EFB: ENGINE_cleanup (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0) ==3716== by 0x7BB64CD: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7BB6E68: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7B926B4: curl_global_cleanup (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0) ==3716== by 0x7959C97: zm_shutdown_curl (in /usr/lib/php5/20121212/curl.so) ==3716== by 0x6F4692: module_destructor (in /usr/bin/php5) ==3716== by 0x6F9904: ??? (in /usr/bin/php5) ==3716== by 0x6FB107: zend_hash_graceful_reverse_destroy (in /usr/bin/php5) ==3716== If you believe this happened as a result of a stack ==3716== overflow in your program's main thread (unlikely but ==3716== possible), you can try to increase the size of the ==3716== main thread stack using the --main-stacksize= flag. ==3716== The main thread stack size used in this run was 8388608. ==3716== ==3716== HEAP SUMMARY: ==3716== in use at exit: 3,561,791 bytes in 18,770 blocks ==3716== total heap usage: 26,502 allocs, 7,732 frees, 5,611,800 bytes allocated ==3716== ==3716== LEAK SUMMARY: ==3716== definitely lost: 0 bytes in 0 blocks ==3716== indirectly lost: 0 bytes in 0 blocks ==3716== possibly lost: 0 bytes in 0 blocks ==3716== still reachable: 3,561,791 bytes in 18,770 blocks ==3716== suppressed: 0 bytes in 0 blocks ==3716== Rerun with --leak-check=full to see details of leaked memory ==3716== ==3716== For counts of detected and suppressed errors, rerun with: -v ==3716== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Segmentation fault (core dumped)