diff options
author | Ermal <eri@pfsense.org> | 2013-12-14 19:20:39 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-12-14 19:20:55 +0000 |
commit | 4aea91d808a12b8bbdcbded370b525e7ac292a47 (patch) | |
tree | bfd8008ce0f7aa3b19ec29998b958f9b9ef9bf4d /etc/rc.php_ini_setup | |
parent | da49fd899695b7d860ef3b938064eedbb2b995de (diff) | |
download | pfsense-4aea91d808a12b8bbdcbded370b525e7ac292a47.zip pfsense-4aea91d808a12b8bbdcbded370b525e7ac292a47.tar.gz |
Switch to php-fpm for lighty and check_reload_status will use it. Step by step will migrate the other calls
Diffstat (limited to 'etc/rc.php_ini_setup')
-rwxr-xr-x | etc/rc.php_ini_setup | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 589fab8..1105773 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -53,7 +53,7 @@ REALMEM=`/sbin/sysctl hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/ export REALMEM export LOWMEM -if [ "$REALMEM" -lt "$MIN_REALMEM_FOR_APC" ]; then +if [ ${REALMEM} -lt $MIN_REALMEM_FOR_APC ]; then LOWMEM="TRUE" echo ">>> Under $MIN_REALMEM_FOR_APC megabytes of ram detected. Not enabling APC." echo ">>> Under $MIN_REALMEM_FOR_APC megabytes of ram detected. Not enabling APC." | /usr/bin/logger -p daemon.info -i -t rc.php_ini_setup @@ -296,6 +296,73 @@ suhosin.memory_limit = 512435456 EOF +PHPFPMMAX=2 +if [ "$LOWMEM" = "TRUE" ]; then + PHPFPMMAX=1 +elif [ ${REALMEM} -gt 1000 ]; then + PHPFPMMAX=4 +fi + +/bin/cat > /usr/local/lib/php-fpm.conf <<EOF + +[global] +pid = run/php-fpm.pid +error_log=syslog +syslog.facility = daemon +syslog.ident = php-fpm +log_level = notice +daemonize = yes +events.mechanism = kqueue +process.max = ${PHPFPMMAX} + +[lighty] +user = root +group = wheel +;mode = 0600 + +listen = /var/run/php-fpm.socket +listen.owner = root +listen.group = wheel +listen.mode = 0600 + +security.limit_extensions = + +EOF + +if [ "$LOWMEM" = "TRUE" ]; then + /bin/cat >> /usr/local/lib/php-fpm.conf <<EOF + +pm = ondemand +pm.process_idle_timeout = 5 +pm.max_children = 1 +pm.max_requests = 500 + +EOF + +elif [ $REALMEM -gt 1000 ]; then + /bin/cat >> /usr/local/lib/php-fpm.conf <<EOF + +pm = dynamic +pm.process_idle_timeout = 5 +pm.max_children = 3 +pm.start_servers = 1 +pm.max_requests = 500 +pm.min_spare_servers=1 +pm.max_spare_servers=1 + +EOF +else + + /bin/cat >> /usr/local/lib/php-fpm.conf <<EOF + +pm = static +pm.max_children = 2 +pm.max_requests = 500 + +EOF + +fi + # Copy php.ini file to etc/ too (cli) /bin/cp /usr/local/lib/php.ini /usr/local/etc/php.ini |