PHP Extensions Crash Fix

Often, when a new version of PHP comes out you will see that after upgrading that your apache process will have crash messages in /var/log/messages. So far, there has been no official workaround for the problem. The problem is caused by the order that the PHP extensions are loaded. Below, you can see the messages you would see in your logs:

Dec 31 01:58:05 tethys kernel: pid 80881 (httpd), uid 80: exited on signal 6
Dec 31 02:34:26 tethys kernel: pid 82854 (httpd), uid 80: exited on signal 6
Dec 31 02:48:44 tethys kernel: pid 84462 (httpd), uid 80: exited on signal 6
Dec 31 02:48:48 tethys kernel: pid 84430 (httpd), uid 80: exited on signal 6
Dec 31 02:49:05 tethys kernel: pid 84452 (httpd), uid 80: exited on signal 6
Dec 31 02:49:36 tethys kernel: pid 83837 (httpd), uid 80: exited on signal 6
Dec 31 03:10:48 tethys kernel: pid 92268 (httpd), uid 80: exited on signal 6
Dec 31 03:42:19 tethys kernel: pid 94089 (httpd), uid 80: exited on signal 6
Dec 31 03:42:19 tethys kernel: pid 93634 (httpd), uid 80: exited on signal 6
Dec 31 03:42:20 tethys kernel: pid 94082 (httpd), uid 80: exited on signal 6
Dec 31 03:42:20 tethys kernel: pid 93626 (httpd), uid 80: exited on signal 6

From Pingle.org, I found a script that provides for a fix to this. I've downloaded the most current one and offer it from my server unmodified and with attributions in place, just in case the internet shifts and this file isn't available any more.

The easiest way to use this is as follows:

# portmaster -ad
# /path/to/fixphpextorder.sh
# /usr/local/etc/rc.d/apache2 restart

You can download the script here. This has been updated numerous times, most recently on 4/3/2011 by Olli Hauer. If you have any issues, drop me a note and I can update the script or reach out to the updaters.