remove php-fpm from rc scripting and revert back to php-cgi

This commit is contained in:
Ad Schellevis 2014-11-10 18:48:15 +01:00
parent 45f98dc12e
commit 3b16afcf61
5 changed files with 5 additions and 107 deletions

View File

@ -995,9 +995,11 @@ server.errorlog-use-syslog="enable"
EOD;
}
if ($captive_portal !== false)
$fast_cgi_path = "{$g['tmp_path']}/php-fastcgi-{$captive_portal}.socket";
else
$fast_cgi_path = "{$g['tmp_path']}/php-fastcgi.socket";
if ($captive_portal !== false) {
$fast_cgi_path = "{$g['tmp_path']}/php-fastcgi-{$captive_portal}.socket";
$fastcgi_config = <<<EOD
#### fastcgi module
## read fastcgi.txt for more info
@ -1010,28 +1012,12 @@ fastcgi.server = ( ".php" =>
"PHP_FCGI_CHILDREN" => "{$max_php_children}",
"PHP_FCGI_MAX_REQUESTS" => "500"
),
"bin-path" => "/usr/local/bin/php"
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)
EOD;
} else {
$fast_cgi_path = "{$g['varrun_path']}/php-fpm.socket";
$fastcgi_config = <<<EOD
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "{$fast_cgi_path}",
"broken-scriptfilename" => "enable"
)
)
)
EOD;
}
$lighty_config = <<<EOD

2
etc/rc
View File

@ -385,7 +385,6 @@ echo "done."
# Run the php.ini setup file and populate
# /usr/local/etc/php.ini and /usr/local/lib/php.ini
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
/usr/local/sbin/php-fpm -c /usr/local/lib/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null
# Launch external configuration loader for supported platforms
if [ "$PLATFORM" = "nanobsd" ]; then
@ -403,7 +402,6 @@ if [ -f /etc/rc.custom_boot_early ]; then
echo "Done"
fi
export fcgipath=/var/run/php-fpm.socket
chmod u+rx /usr/local/opnsense/check_reload_status.py
/usr/bin/nice -n20 /usr/local/opnsense/check_reload_status.py
sleep 1 # give check_reload_status some time to load to prevent missing socket

View File

@ -89,7 +89,6 @@ echo " 4) Reset to factory defaults 12) ${product} Developer Shell"
echo " 5) Reboot system 13) Upgrade from console"
echo " 6) Halt system ${sshd_option}"
echo " 7) Ping host 15) Restore recent configuration"
echo " 17) Restart PHP-FPM "
echo " ${option98} "
if [ "${option99}" != "" ]; then
@ -153,9 +152,6 @@ case ${opmode} in
16)
/etc/rc.banner
;;
17)
/etc/rc.php-fpm_restart
;;
98)
if [ ! -f /tmp/config_moved ]; then
/etc/rc.initial.store_config_to_removable_device

View File

@ -1,11 +0,0 @@
#!/bin/sh
/bin/pkill -F /var/run/php-fpm.pid
sleep 2
# Run the php.ini setup file and populate
# /usr/local/etc/php.ini and /usr/local/lib/php.ini
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
echo ">>> Restarting php-fpm" | /usr/bin/logger -p daemon.info -i -t rc.php-fpm_restart
/usr/local/sbin/php-fpm -c /usr/local/lib/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null

View File

@ -303,77 +303,6 @@ suhosin.memory_limit = 512435456
EOF
PHPFPMMAX=3
if [ $REALMEM -lt 250 ]; then
PHPFPMMAX=2
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 = system
log_level = error
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 =
; Pass environment variables
env[PATH] = /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
env[LOGNAME] = root
EOF
if [ $REALMEM -lt 350 ]; then
/bin/cat >> /usr/local/lib/php-fpm.conf <<EOF
pm = ondemand
pm.process_idle_timeout = 5
pm.max_children = $PHPFPMMAX
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 = $PHPFPMMAX
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 = $PHPFPMMAX
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