[mod_fastcgi,mod_scgi] warn if invalid "bin-path"

e.g. if /usr/bin/php-cgi does not exist

A distribution package might need to be installed:
'php-cli' Fedora package; 'php7.0-cgi' or 'php5-cgi' Debian package
This commit is contained in:
Glenn Strauss 2016-12-03 21:19:10 -05:00
parent 7d339e21db
commit f9737e50a6
2 changed files with 24 additions and 0 deletions

View File

@ -1469,6 +1469,18 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
/* a local socket + self spawning */
size_t pno;
struct stat st;
size_t nchars = strcspn(host->bin_path->ptr, " \t");
char c = host->bin_path->ptr[nchars];
host->bin_path->ptr[nchars] = '\0';
if (0 == nchars || 0 != stat(host->bin_path->ptr, &st) || !S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
host->bin_path->ptr[nchars] = c;
log_error_write(srv, __FILE__, __LINE__, "SSs",
"invalid \"bin-path\" => \"", host->bin_path->ptr,
"\" (check that file exists, is regular file, and is executable by lighttpd)");
}
host->bin_path->ptr[nchars] = c;
if (s->debug) {
log_error_write(srv, __FILE__, __LINE__, "ssbsdsbsd",
"--- fastcgi spawning local",

View File

@ -1214,6 +1214,18 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
/* a local socket + self spawning */
size_t pno;
struct stat st;
size_t nchars = strcspn(df->bin_path->ptr, " \t");
char c = df->bin_path->ptr[nchars];
df->bin_path->ptr[nchars] = '\0';
if (0 == nchars || 0 != stat(df->bin_path->ptr, &st) || !S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
df->bin_path->ptr[nchars] = c;
log_error_write(srv, __FILE__, __LINE__, "SSs",
"invalid \"bin-path\" => \"", df->bin_path->ptr,
"\" (check that file exists, is regular file, and is executable by lighttpd)");
}
df->bin_path->ptr[nchars] = c;
/* HACK: just to make sure the adaptive spawing is disabled */
df->min_procs = df->max_procs;