Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 487642 - dev-lang/php - Configuration check before reloading FPM
Summary: dev-lang/php - Configuration check before reloading FPM
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-11 13:47 UTC by manwe
Modified: 2015-11-24 20:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description manwe 2013-10-11 13:47:43 UTC
In my opinion there should be configtest() at the begining of reload() in /etc/init.d/php-fpm just like in /etc/init.d/nginx 

reload() {
        configtest || return 1
        ebegin "Reloading PHP FastCGI Process Manager"
        set_phpvars
        [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
        eend $?
}


configtest() {
        ebegin "Checking PHP FastCGI configuration"
        set_phpvars
        /usr/lib/${PHPSLOT}/bin/php-fpm -y "${PHP_FPM_CONF}" -t &> /dev/null
        if [ $? -ne 0 ]; then
                /usr/lib/${PHPSLOT}/bin/php-fpm -y "${PHP_FPM_CONF}" -t
        fi
        eend $? "failed, please correct errors above"
}

This way you could avoid reloading FPM when modified config has for example syntax error which causes FPM to stop working and requires /etc/init.d/php-fpm restart. 

Reproducible: Always

Steps to Reproduce:
1. change php-fpm.conf to contain error, like syntax
2. /etc/init.d/php-fpm reload
Actual Results:  
FPM dead

Expected Results:  
Configuration checked, no kill -USR2 executed.
Comment 1 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-10-11 17:52:46 UTC
Which version of dev-lang/php is this?
Comment 2 manwe 2013-10-11 17:54:08 UTC
5.5.4
Comment 3 Michael Orlitzky gentoo-dev 2015-11-24 20:18:16 UTC
This should be fixed, thanks for the suggestion! I added the same line before start() so that, if the config is bad, you don't have to wait five seconds.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0709457d61898989510adfa26c4cb615f18165b