После обновления PHP до версии 5.6.22 любое выполнение скриптов может приводить к возникновению ошибки «Segmentation fault».
1 2 |
$ php -c . test.php Segmentation fault |
Определение причины «Segmentation fault» под отладкой
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
$ gdb --args php -c . test.php GNU gdb (GDB) CentOS (7.0.1-45.el5.centos) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/local/bin/php...done. (gdb) run Starting program: /usr/local/bin/php -c . test.php warning: .dynamic section for "/usr/lib/libidn.so.11" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/libfreetype.so.6" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/libldap_r-2.3.so.0" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/liblber-2.3.so.0" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/usr/lib/libsasl2.so.2" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for "/lib/libselinux.so.1" is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations [Thread debugging using libthread_db enabled] Program received signal SIGSEGV, Segmentation fault. _phpi_pop (ht=, return_value=0xb796294c, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0, off_the_end=0) at /root/php-5.6.22/ext/standard/array.c:1879 1879 RETVAL_ZVAL_FAST(*val); (gdb) |
Ошибка известная, источник ошибки в модуле XHprof.
Подробнее здесь: Bug #68059 array_shift segfaults.
Решение
Отключить модуль XHprof или использовать его с версией PHP ниже 5.6.