How to trace Apache segmentation fault?


2016-11-16 12:44:25 UTC


2017-08-22 13:13:43 UTC


Was this article helpful?

Have more questions?

Submit a request

How to trace Apache segmentation fault?

Applicable to:

  • Plesk for Linux


  • Webpages return an HTTP error 500 in the main apache log usually it located in /var/log/httpd/error_log or /var/log/apache2/error_log .
  • "Segmentation fault" error can be found in Apache log files.


Some extension or interoperability with OS module causes a crash.


  1. Find a partition having a free space enough to store several memory dumps. In this example, it will be root '/' partition.

  2. Modify Apache startup script:

    • For Debian-based systems add ulimit -c unlimited in /etc/init.d/apache2 , in do_start() section.

    • For RHEL-based OSes with init add DAEMON_COREFILE_LIMIT=unlimited to /etc/sysconfig/httpd file.
    • For systemd systems add LimitCORE=infinity in [Service] section of the unit file, e.g. for CentOS 7:

      [root@server ~]# cat /etc/systemd/system/
  3. Create a folder where core dumps will be stored:
    # mkdir -p /tmp/coredumps
    # chmod a+w /tmp/coredumps
  4. Modify /proc/sys/kernel/core_pattern to relative path

    # echo /tmp/coredumps/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern

    Note: if for some reason core_pattern can not be modified, it will be saved in a directory from where application started or CoreDumpDirectory location (see below).

  5. Add CoreDumpDirectory directive in httpd.conf and specify a location for a core dump file:

    [root@server ~]# grep "CoreDumpDirectory" /etc/httpd/conf/httpd.conf
    CoreDumpDirectory "/tmp/coredumps"
  6. Restart Apache service.

    Note: in order to test configuration you can send kill -SIGSEGV to Apache child and check whether dump file has been created.

  7. Open affected website/page in a browser and wait for 500 error.
  8. Ensure that core dump has been created in /tmp/coredumps/ directory.

    Note: that if abrtd daemon is running, it will prevent creation of core dump files.

  9. Remove ulimit -c unlimited from the init script and restart Apache.

  10. To analyse the core dump, pass the core dump filename on the gdb utility:

    gdb /usr/sbin/apache2 /tmp/coredumps/core-php-cgi-11-10007-1004-13087-1482920422
  11. Execute bt command at the gdb prompt to get backtrace and analyse output:

    (gdb) bt

Additional information

Have more questions? Submit a request
Please sign in to leave a comment.