Segmentation fault on certain WordPress pages on Ubuntu / Apache / PHP

February 3, 2015 6k views

I'm getting reproducible errors when trying to access certain parts of a WordPress instance. This identical behavior occurs on two WordPress instances hosted on the same box.

The two actions that fail (and lead to an error page in Chrome (Error code: ERREMPTYRESPONSE), and an error logged on server) are:

  • Attempting to access the "General" settings page (/wp-admin/options-general.php)
  • Attempting to confirm the deletion of any plugin

Apache2 error.log:
[core:notice] [pid 9173] AH00052: child pid 9177 exit signal Segmentation fault (11)
[core:notice] [pid 9173] AH00052: child pid 9181 exit signal Segmentation fault (11)

Server Info:
Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-24-generic x86_64)

PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Please let me know what other information may be helpful. Thanks in advance.

  • Do you have any additional plugins installed in these Wordpress instances?

  • I have a few, one of the instances has the following list:

    • Akismet
    • Google Analytics by Yoast
    • Google Apps Login
    • ImageInject
    • Jetpack by WordPress.com
    • Maintenance
    • WP Retina 2x

    I've tried deactivating them all, but the error still occurs when no plugins are active.

    The other has more, haven't tried deactivating them all on this one:

    • Akismet
    • Contact Form 7
    • Digg Digg
    • Disable Comments
    • Download Monitor
    • Enable Media Replace
    • Google Analytics by Toast
    • Google Apps Login
    • ImageInject
    • Maintenance
    • Membership
    • MyThemeShop Connect
    • Really Simple CAPTCHA
    • Regenerate Thumbnails
    • Remove Dashboard Access
    • Responsive Lightbox
    • UpdraftPlus - Backup/Restore
    • WordPress SEO
    • WP-Mail-SMTP
    • WP Retina 2x
    • WP Shortcode by MyThemeShop
    • WP Tab Widget
9 Answers

I found a fix for this, it requires a patch update of libssh2-php. See this thread here: https://bugs.launchpad.net/ubuntu/+source/php-ssh2/+bug/1407377

apt-get source libssh2-php
cd php-ssh2-0.12/
wget https://launchpadlibrarian.net/193989033/fix-segfault.patch
apt-get build-dep php-ssh2
apt-get install build-essential fakeroot devscripts
patch -p1 < fix-segfault.patch 
rm fix-segfault.patch 
debchange -i
dpkg-buildpackage -b

Restarted my Droplet (you could probably just restart Apache) and it works now!

  • Thank you so much, it works!

    I have setup more than 5 VPS on DO with WordPress installed but I just got this problem happen with my last installation, very weird.

  • Thanks a lot! this totally fixed my issue.

Thanks for your help Emily. Unfortunately after applying that patch, same issue seems to recur. The bug description really sounded like it was exactly my problem. Wonder if I'm doing something wrong applying the patch.

I did try restarting Apache, and also the entire box.

@emilyhorsman YOU are such a life saver.

Thank You so much! I was able to solve this issue that was getting me really frustrated after setting up ssh/wordpress on DigitalOcean.

@emilyhorsman - Thanks, this worked great.

I had followed this tutorial on secure updates, and had the same issue.

Be sure to sudo on the commands (if needed) -- I also found that I just needed to restart Apache, not the droplet.

by Justin Ellingwood
WordPress is the most popular content management system (CMS) on the web currently. While WordPress can be a great way to manage you content, there are some very insecure configurations that are given throughout the internet. This article will cover how to set up secure updates and installations using SSH keys instead of FTP, which is an inherently insecure protocol.

@emilyhorsman: Found my error - was a a silly one. Thanks so much for your help!

you absolute legend this fixed and issue i was having with a script!!

After an entire day of trying to trace this down, no solutions worked. I eventually however turned Apache to debug level logging and immediately noticed hundreds of notices/warnings with Google's mod_pagespeed for Apache trying to rewrite images from Jetpack's Photon images.

I did a simple a2dismod pagespeed and immediately there were no more segmentation faults.

Have also noticed my sites are actually running faster now with mod pagespeed turned off.

There seems to be quite a few bug reports about pagespeed causing segmentation faults.

Not sure if its just modpagespeed or the combination of modpagespeed, wordpress and php .... but turned off now problem gone.

I am done with it for now and in the process of moving everything to Nginx now. Tracing faults on Apache always turns into a nightmare, with Nginx I can find errors in a few seconds to a minute. Already spent the last 6 weeks getting to know Nginx and it rocks and now going back to my Apache server to try and diagnose this segfault error felt like I was in a different world where I could not speak the language anymore.

Have another answer? Share your knowledge.