title: Xdebug Segmentation Fault
body: <p>So first off I want to say that we have researched this issue for 4 days straight trying to figure out a solution but have been unable to find an answer that worked.</p>
  
  <p>So about two weeks ago we decided as a company that it was time to upgrade our ubuntu web servers to the latest version. So we went ahead with the upgrade and everything seemed to go very smooth. This was until we tried to use xdebug to debug a magento application. </p>
  
  <p>We had xdebug on our previous version of ubuntu and were able to debug flawlessly without any issues. We now get segmentation fault errors everytime we try to debug the Magento Website. </p>
  
  <p>You can see our php.ini file in the pastebin link below. We also have a local php override with the following options:
  xdebug.remote_host = localcomputerip
  xdebug.remote_port = 9001</p>
  
  <p>PHP ini file <a href="http://pastebin.com/UYLviByW" rel="nofollow">http://pastebin.com/UYLviByW</a></p>
  
  <p>We use both Visual Studio and netbeans for debugging in our environment. When we start the debug session it actually breaks initially on the index.php file. We can step through the process for a little while until random points of the application. At this point a segmentation fault is created in the apache2 log file like the following:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[Tue Dec 23 16:09:25.756786 2014] [core:notice] [pid 31832] AH00051: child pid 31838 exit signal Segmentation fault (11), possible coredump in /etc/apache2</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you see a core dump happened. We also get the following that shows up in the xdebug log file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Log opened at 2014-12-23 18:30:11
  I: Connecting to configured address/port: 10.10.10.144:9001.
  I: Connected to client. :-)
  -&gt; &lt;init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/magento.dev.com/public_html/index.php" language="PHP" protocol_version="1.0" appid="15222" idekey="netbeans-xdebug"&gt;&lt;engine version="2.2.6"&gt;&lt;![CDATA[Xdebug]]&gt;&lt;/engine&gt;&lt;author&gt;&lt;![CDATA[Derick Rethans]]&gt;&lt;/author&gt;&lt;url&gt;&lt;![CDATA[http://xdebug.org]]&gt;&lt;/url&gt;&lt;copyright&gt;&lt;![CDATA[Copyright (c) 2002-2014 by Derick Rethans]]&gt;&lt;/copyright&gt;&lt;/init&gt;
  
  Log opened at 2014-12-23 18:30:36
  I: Connecting to configured address/port: 10.10.10.144:9001.
  E: Time-out connecting to client. :-(
  Log closed at 2014-12-23 18:30:36</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see the client times out on the second connect. </p>
  
  <p>With the core dump file in hand I have followed the following information:
  <a href="http://sysadmin.carlusgg.com/?p=197" rel="nofollow">http://sysadmin.carlusgg.com/?p=197</a> and</p>
  
  <p>So going thru the stack trace of the core dump i get the following output. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Find the GDB manual and other documentation resources online at:
  &lt;http://www.gnu.org/software/gdb/documentation/&gt;.
  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from apache2...Reading symbols from /usr/lib/debug//usr/sbin/apache2...done.
  done.
  [New LWP 32601]
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
  
  warning: the debug information found in "/usr/lib/debug//usr/lib/php5/20121212/mysql.so" does not match "/usr/lib/php5/20121212/mysql.so" (CRC mismatch).
  
  
  warning: the debug information found in "/usr/lib/debug/usr/lib/php5/20121212/mysql.so" does not match "/usr/lib/php5/20121212/mysql.so" (CRC mismatch).
  
  
  warning: the debug information found in "/usr/lib/debug//usr/lib/php5/20121212/mysqli.so" does not match "/usr/lib/php5/20121212/mysqli.so" (CRC mismatch).
  
  
  warning: the debug information found in "/usr/lib/debug/usr/lib/php5/20121212/mysqli.so" does not match "/usr/lib/php5/20121212/mysqli.so" (CRC mismatch).
  
  
  warning: the debug information found in "/usr/lib/debug//usr/lib/php5/20121212/pdo_mysql.so" does not match "/usr/lib/php5/20121212/pdo_mysql.so" (CRC mismatch).
  
  
  warning: the debug information found in "/usr/lib/debug/usr/lib/php5/20121212/pdo_mysql.so" does not match "/usr/lib/php5/20121212/pdo_mysql.so" (CRC mismatch).
  
  Core was generated by `/usr/sbin/apache2 -k start'.
  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  xdebug_add_stack_frame (zdata=zdata@entry=0x7f6757eec398, op_array=op_array@entry=0x7f6759f54e80, type=type@entry=2) at /home/icstech/xdebug-2.2.5/xdebug_stack.c:1112
  1112                                    tmp-&gt;var[tmp-&gt;varc].name = NULL;
  (gdb) bt
  #0  xdebug_add_stack_frame (zdata=zdata@entry=0x7f6757eec398, op_array=op_array@entry=0x7f6759f54e80, type=type@entry=2) at /home/icstech/xdebug-2.2.5/xdebug_stack.c:1112
  #1  0x00007f67510e8dcc in xdebug_execute_ex (execute_data=0x7f6757eec4e8) at /home/icstech/xdebug-2.2.5/xdebug.c:1372
  #2  0x00007f675138e0aa in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #3  0x00007f6751386a30 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #4  0x00007f675138a127 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #5  0x00007f675138e0aa in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #6  0x00007f6751386a30 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #7  0x00007f675138a127 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #8  0x00007f675138e0aa in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #9  0x00007f6751386a30 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #10 0x00007f675138a127 in ?? () from /usr/local/ioncube/ioncube_loader_lin_5.5.so
  #11 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eebc80) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #12 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eebc80) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #13 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #14 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eebc80) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #15 0x00007f6753ec2ea1 in zend_call_function (fci=fci@entry=0x7fff4adeef50, fci_cache=&lt;optimized out&gt;, fci_cache@entry=0x7fff4adeef20)
      at /build/buildd/php5-5.5.9+dfsg/Zend/zend_execute_API.c:939
  #16 0x00007f6753df6592 in zif_call_user_func_array (ht=&lt;optimized out&gt;, return_value=0x7f675afb27d8, return_value_ptr=&lt;optimized out&gt;, this_ptr=&lt;optimized out&gt;,
      return_value_used=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/ext/standard/basic_functions.c:4806
  #17 0x00007f6753ec0c6b in dtrace_execute_internal (execute_data_ptr=&lt;optimized out&gt;, fci=&lt;optimized out&gt;, return_value_used=&lt;optimized out&gt;)
      at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:97
  #18 0x00007f67510e9a46 in xdebug_execute_internal (current_execute_data=0x7f6757eeba70, fci=0x0, return_value_used=0) at /home/icstech/xdebug-2.2.5/xdebug.c:1551
  #19 0x00007f6753f80cc5 in zend_do_fcall_common_helper_SPEC (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:552
  #20 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeba70) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #21 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #22 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeba70) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #23 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb8e8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  ---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---
  #24 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb8e8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #25 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #26 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb8e8) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #27 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb788) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #28 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb788) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #29 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #30 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb788) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #31 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb628) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #32 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb628) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #33 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #34 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb628) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #35 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb4c0) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #36 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb4c0) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #37 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #38 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb4c0) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #39 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb2a8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #40 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb2a8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #41 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #42 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb2a8) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #43 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb170) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #44 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb170) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #45 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #46 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb170) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #47 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeb068) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #48 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeb068) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #49 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #50 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeb068) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  ---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---
  #51 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeae90) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #52 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeae90) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #53 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #54 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeae90) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #55 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeac80) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #56 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeac80) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #57 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #58 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeac80) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #59 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eeab30) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #60 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eeab30) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #61 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #62 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eeab30) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #63 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eea9d8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #64 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eea9d8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #65 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #66 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eea9d8) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #67 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eea838) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #68 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eea838) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #69 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #70 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eea838) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #71 0x00007f6753f81310 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6757eea6f8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
  #72 0x00007f6753efa9f8 in execute_ex (execute_data=0x7f6757eea6f8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
  #73 0x00007f6753ec0b69 in dtrace_execute_ex (execute_data=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
  #74 0x00007f67510e8fcc in xdebug_execute_ex (execute_data=0x7f6757eea6f8) at /home/icstech/xdebug-2.2.5/xdebug.c:1437
  #75 0x00007f6753ed25f0 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /build/buildd/php5-5.5.9+dfsg/Zend/zend.c:1316
  #76 0x00007f6753e724d5 in php_execute_script (primary_file=primary_file@entry=0x7fff4adf3240) at /build/buildd/php5-5.5.9+dfsg/main/main.c:2506
  #77 0x00007f6753f8294a in php_handler (r=&lt;optimized out&gt;) at /build/buildd/php5-5.5.9+dfsg/sapi/apache2handler/sapi_apache2.c:667
  ---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---
  #78 0x00007f6758061680 in ap_run_handler (r=0x7f6757eca0a0) at config.c:169
  #79 0x00007f6758061bc9 in ap_invoke_handler (r=r@entry=0x7f6757eca0a0) at config.c:439
  #80 0x00007f675807716a in ap_process_async_request (r=0x7f6757eca0a0) at http_request.c:317
  #81 0x00007f6758077444 in ap_process_request (r=r@entry=0x7f6757eca0a0) at http_request.c:363
  #82 0x00007f6758073f02 in ap_process_http_sync_connection (c=0x7f6757ed0290) at http_core.c:190
  #83 ap_process_http_connection (c=0x7f6757ed0290) at http_core.c:231
  #84 0x00007f675806acc0 in ap_run_process_connection (c=0x7f6757ed0290) at connection.c:41
  #85 0x00007f675806b0a8 in ap_process_connection (c=c@entry=0x7f6757ed0290, csd=&lt;optimized out&gt;) at connection.c:202
  #86 0x00007f67548a2767 in child_main (child_num_arg=child_num_arg@entry=3) at prefork.c:704
  #87 0x00007f67548a29a6 in make_child (s=0x7f6757fd0de0, slot=slot@entry=3) at prefork.c:800
  #88 0x00007f67548a2a06 in startup_children (number_to_start=2) at prefork.c:818
  #89 0x00007f67548a36e0 in prefork_run (_pconf=&lt;optimized out&gt;, plog=0x7f6757fcc028, s=0x7f6757fd0de0) at prefork.c:976
  #90 0x00007f675804869e in ap_run_mpm (pconf=0x7f6757ffe028, plog=0x7f6757fcc028, s=0x7f6757fd0de0) at mpm_common.c:96
  #91 0x00007f6758041e36 in main (argc=3, argv=0x7fff4adf3968) at main.c:777</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now I am no linux expert at all but this has me confused. We have tried the following things at this point: 
  Tried xdebug versions 2.2.3 - 2.2.6
  Uninstalled Ioncube
  Uninstalled Zend OPCache
  Turned off PHP Buffer Output.
  Tried reinstalling Xdebug from scratch
  Recompiled Apache
  Reinstalled PHP 5.5
  Opened the ports in iptables
  Restarted the Web Server</p>
  
  <p>Now let me explain our server setup. This is an internal development server to our local network. It has ubuntu 14.04 installed on it. All firewall ports both internally and externally are opened properly for the ports. This is a virtual machine running on a power server. </p>
  
  <p>My eyes are starting to bleed as we are getting to tip of my linux knowledge. There is also one big kicker to this problem. We have WordPress sites on the same server. Sometimes we are actually able to successfully debug through an entire session of WordPress. Other times we are not able to debug wordpress and run into the same problem. That makes the problem even weirder. </p>
  
  <p>Any help that anyone might have at all as to the issue that I am having would be amazing. I am open to pretty much anything right now because this is our development server. </p>
  
  <p>If there is any other information that you need in order to help out with this issue please let me know. For now we are going back to the var_dump and print_r debug methods. </p>