summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorRenato Botelho <garga@pfSense.org>2013-09-03 10:29:52 -0700
committerRenato Botelho <garga@pfSense.org>2013-09-03 10:29:52 -0700
commitfcca1783e98760e1edc6f887872bd643529826dc (patch)
tree474459b3606ef6ee40e09f1f3f34b67886c052a9 /etc
parentfaf4b1fce98694a45bcdc0b9ba27ac7a79654d37 (diff)
parent73fa01787f0574cbfa8bf969a4bc72b7e00eb74d (diff)
downloadpfsense-fcca1783e98760e1edc6f887872bd643529826dc.zip
pfsense-fcca1783e98760e1edc6f887872bd643529826dc.tar.gz
Merge pull request #786 from individual-it/master
Increased needed memory for APC to 512M + code cleanup
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.php_ini_setup60
1 files changed, 33 insertions, 27 deletions
diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup
index b6c2396..a108c62 100755
--- a/etc/rc.php_ini_setup
+++ b/etc/rc.php_ini_setup
@@ -27,6 +27,7 @@
# Set our operating platform
PLATFORM=`/bin/cat /etc/platform`
+MIN_REALMEM_FOR_APC=512
if [ -d /usr/local/lib/php/20090626 ]; then
EXTENSIONSDIR="/usr/local/lib/php/20090626/"
@@ -46,22 +47,35 @@ if [ -z "$AVAILMEM" ]; then
AVAILMEM=`/bin/expr $MEM / 1048576`
fi
-# Calculate APC SHM size according
-# to detected memory values
-if [ "$AVAILMEM" -gt "135" ]; then
- APCSHMEMSIZE="10M"
-fi
-if [ "$AVAILMEM" -gt "256" ]; then
- APCSHMEMSIZE="20M"
-fi
-if [ "$AVAILMEM" -gt "384" ]; then
- APCSHMEMSIZE="25M"
-fi
-if [ "$AVAILMEM" -gt "512" ]; then
- APCSHMEMSIZE="30M"
-fi
-if [ "$AVAILMEM" -gt "784" ]; then
- APCSHMEMSIZE="50M"
+
+# Get amount of ram installed on this system
+REALMEM=`/sbin/sysctl hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/awk -F '.' '{print $1}'`
+export REALMEM
+export LOWMEM
+
+if [ "$REALMEM" -lt "$MIN_REALMEM_FOR_APC" ]; then
+ LOWMEM="TRUE"
+ echo ">>> WARNING! under $MIN_REALMEM_FOR_APC megabytes of ram detected. Not enabling APC."
+ echo ">>> WARNING! under $MIN_REALMEM_FOR_APC megabytes of ram detected. Not enabling APC." | /usr/bin/logger -p daemon.info -i -t rc.php_ini_setup
+else
+
+ # Calculate APC SHM size according
+ # to detected memory values
+ if [ "$AVAILMEM" -gt "135" ]; then
+ APCSHMEMSIZE="10M"
+ fi
+ if [ "$AVAILMEM" -gt "256" ]; then
+ APCSHMEMSIZE="20M"
+ fi
+ if [ "$AVAILMEM" -gt "384" ]; then
+ APCSHMEMSIZE="25M"
+ fi
+ if [ "$AVAILMEM" -gt "512" ]; then
+ APCSHMEMSIZE="30M"
+ fi
+ if [ "$AVAILMEM" -gt "784" ]; then
+ APCSHMEMSIZE="50M"
+ fi
fi
# Set upload directory
@@ -74,7 +88,7 @@ fi
# Define php modules. Do not add .so, it will
# be done automatically by the script below.
PHPMODULES="standard"
-if [ "$AVAILMEM" -gt 135 ]; then
+if [ "$LOWMEM" != "TRUE" ]; then
PHPMODULES="$PHPMODULES apc"
fi
# Config read/write
@@ -249,11 +263,8 @@ for EXT in $PHP_ZEND_MODULES_TS; do
fi
done
-# Get amount of ram installed on this system
-RAM=`/sbin/sysctl hw.realmem | /usr/bin/awk '{print $2/1000000}' | /usr/bin/awk -F '.' '{print $1}'`
-export RAM
-export LOWMEM
-if [ "$RAM" -gt 135 ]; then
+
+if [ "$LOWMEM" != "TRUE" ]; then
/bin/cat >>/usr/local/lib/php.ini <<EOF
@@ -263,11 +274,6 @@ apc.enable_cli="0"
apc.shm_size="${APCSHMEMSIZE}"
EOF
-
-else
- LOWMEM="TRUE"
- echo ">>> WARNING! under 128 megabytes of ram detected. Not enabling APC."
- echo ">>> WARNING! under 128 megabytes of ram detected. Not enabling APC." | /usr/bin/logger -p daemon.info -i -t rc.php_ini_setup
fi
/bin/cat >>/usr/local/lib/php.ini <<EOF
OpenPOWER on IntegriCloud