Wednesday, October 23, 2019

macOS: httpd: child pid 45333 exit signal Segmentation fault (11)

  • macOS 10.15 (Catalina)
  • php 7.3.10
  • Apache 2.4.41
If you try to do SOAP requests with PHP 7 on macOS and you get permanent segmentation faults in the httpd error log, this is due to a bug in the PHP Apache module.
You can have an idea of the reasons of the segmentation fault in the .crash files automatically generated on macOS.
[jerome@jeroboam] > less /Users/jerome/Library/Logs/DiagnosticReports/httpd_2019-10-22-214827_jeroboam.crash
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib            0x00007fff71d21732 _platform_strlen + 18
1   libphp7.so                          0x000000010e5808e9 get_param + 56
2   libphp7.so                          0x000000010e581569 serialize_response_call2 + 648
3   libphp7.so                          0x000000010e57b371 serialize_response_call + 3807
4   libphp7.so                          0x000000010e57a01f zim_SoapServer_handle + 7188
5   libphp7.so                          0x000000010e739fa5 ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER + 412
6   libphp7.so                          0x000000010e709df9 execute_ex + 98
7   libphp7.so                          0x000000010e709f76 zend_execute + 319
8   libphp7.so                          0x000000010e6cfab7 zend_execute_scripts + 277
9   libphp7.so                          0x000000010e67b1a0 php_execute_script + 636
10  libphp7.so                          0x000000010e777f2f php_handler + 1092
11  httpd                               0x000000010dac6443 ap_run_handler + 51
12  httpd                               0x000000010dac69fd ap_invoke_handler + 240
13  httpd                               0x000000010dafc690 ap_internal_redirect + 54
14  mod_rewrite.so                      0x000000010dc895af handler_redirect + 128
15  httpd                               0x000000010dac6443 ap_run_handler + 51
16  httpd                               0x000000010dac69fd ap_invoke_handler + 240
17  httpd                               0x000000010dafc1cb ap_process_async_request + 864
18  httpd                               0x000000010dafc262 ap_process_request + 20
19  httpd                               0x000000010daf9078 ap_process_http_connection + 385
20  httpd                               0x000000010dad6c2c ap_run_process_connection + 51
21  mod_mpm_prefork.so                  0x000000010dc73807 child_main + 1085
22  mod_mpm_prefork.so                  0x000000010dc732c6 make_child + 409
23  mod_mpm_prefork.so                  0x000000010dc7330e startup_children + 72
24  mod_mpm_prefork.so                  0x000000010dc7258b prefork_run + 282
25  httpd                               0x000000010dad8f5f ap_run_mpm + 64
26  httpd                               0x000000010dacd58f main + 2119
27  libdyld.dylib                       0x00007fff71b23405 start + 1
The bug is known and referenced in Bug #73906.
A workaround is also proposed, which consists in having your PHP function return a hash map.
For example, if your function return an array of requestId + sessionAuthId, then replace it with
array('requestId' => $result[0], 'sessionAuthId' => $result[1])
.