summaryrefslogtreecommitdiffstats
path: root/etc/rc.php_ini_setup
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-11-21 16:14:25 -0500
committerScott Ullrich <sullrich@pfsense.org>2009-11-21 16:14:25 -0500
commit2b11ff4db021d793dda7bb7bbf460f7d0d528bd7 (patch)
treeed1886ea5b2f84c5b6a99a3e16895b7062ea4602 /etc/rc.php_ini_setup
parent483e6de8423236fd6af30de585caa72a507758f1 (diff)
downloadpfsense-2b11ff4db021d793dda7bb7bbf460f7d0d528bd7.zip
pfsense-2b11ff4db021d793dda7bb7bbf460f7d0d528bd7.tar.gz
Calculate PHP APC SHM size according to memory detected
Diffstat (limited to 'etc/rc.php_ini_setup')
-rwxr-xr-xetc/rc.php_ini_setup23
1 files changed, 22 insertions, 1 deletions
diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup
index 08aed85..6d1315e 100755
--- a/etc/rc.php_ini_setup
+++ b/etc/rc.php_ini_setup
@@ -28,7 +28,28 @@
# Set our operating platform
PLATFORM=`cat /etc/platform`
EXTENSIONSDIR="/usr/local/lib/php/20060613/"
-APCSHMEMSIZE="25"
+AVAILMEM=`cat /var/log/dmesg.boot | grep "memory" | grep "avail" | awk '{ print $5 }' | cut -d'(' -f2 | cut -d'M' -f1`
+
+# Calculate APC SHM size according
+# to detected memory values
+if [ "$AVAILMEM" -lt "128" ]; then
+ APCSHMEMSIZE="5"
+fi
+if [ "$AVAILMEM" -gt "128" ]; then
+ APCSHMEMSIZE="25"
+fi
+if [ "$AVAILMEM" -gt "256" ]; then
+ APCSHMEMSIZE="45"
+fi
+if [ "$AVAILMEM" -gt "384" ]; then
+ APCSHMEMSIZE="65"
+fi
+if [ "$AVAILMEM" -gt "512" ]; then
+ APCSHMEMSIZE="80"
+fi
+if [ "$AVAILMEM" -gt "784" ]; then
+ APCSHMEMSIZE="100"
+fi
# Set upload directory
if [ "$PLATFORM" = "embedded" -o "$PLATFORM" = "nanobsd" ]; then
OpenPOWER on IntegriCloud