aolserver, php and stack size

Today, Cristian Andrei Calin asked on the AOLSERVER mailing list (and here’s my final response containing the solution outlined below) about getting PHP working under AOLserver. Specifically, trying to get phpBB2 working, which was causing AOLserver to crash. So, being the ever-so-eager-to-help self, I decided to download the latest phpBB2 code and try and install it.

After lots of walking of stack-traces of core dumps in gdb, it dawned on me: I should check the per-thread stack size in AOLserver! Duh. Yes, I had it set to the default of 128KB. Increasing it to 1MB made everything work perfectly.

To check what your server’s current stack size is, connect to the control port (aka “nscp into your server”) and issue the command:

  nscp> ns_config ns/threads stacksize

There, it’s telling me that the stack size is 131,072 bytes (or 128KB). Increase it by modifying your config .tcl file like so:

  ns_section "ns/threads"
  ns_param stacksize [expr 1024 * 1024]    ;# 1MB

For sites that run a lot of PHP, you may want to increase it to 4MB or even larger, depending on your needs.

Speak Your Mind