Add PHP support in Pi-hole' HTTP server.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-05-28 23:59:52 +02:00
parent 6e40e3b2dc
commit 308c80bc5a
4 changed files with 16 additions and 2 deletions
+3
View File
@@ -324,6 +324,9 @@ void http_init(void)
"X-Xss-Protection: 1; mode=block\r\n"
"X-Content-Type-Options: nosniff\r\n"
"Referrer-Policy: same-origin",
"cgi_interpreter", httpsettings.php_location,
"cgi_pattern", "**.php$", // ** allows the files to by anywhere inside the web root
"index_files", "index.html,index.htm,index.php",
NULL
};
+1 -2
View File
@@ -14,7 +14,6 @@ set(sources
)
# We can remove the NO_SSL later on. It adds additional constraints to the build system (availablity of libSSL-dev)
# NO_CGI = no CGI support (we don't need it)
# NO_SSL_DL NO_SSL = no SSL support (for now)
# USE_SERVER_STATS = makes a few anonymous statistics available, such as
# - Number of connections (currently and total)
@@ -26,5 +25,5 @@ set(CIVETWEB_OPTS
add_library(civetweb OBJECT ${sources})
target_compile_definitions(civetweb PRIVATE NO_CGI NO_SSL_DL NO_SSL USE_SERVER_STATS USE_IPV6)
target_compile_definitions(civetweb PRIVATE NO_SSL_DL NO_SSL USE_SERVER_STATS USE_IPV6)
target_include_directories(civetweb PRIVATE ${PROJECT_SOURCE_DIR}/src)
+11
View File
@@ -448,6 +448,17 @@ void read_FTLconf(void)
else
logg(" API_PRETTY_JSON: Disabled. Compact API output.");
// PHP-CGI
// defaults to: /usr/bin/php-cgi
// Path to an executable to use as CGI interpreter for all CGI scripts
// regardless of the script file extension. We use this for PHP. It
// needs to point at php-cgi. php-cli will not work
httpsettings.php_location = "/usr/bin/php-cgi";
buffer = parse_FTLconf(fp, "PHP.CGI");
if(buffer != NULL)
httpsettings.php_location = strdup(buffer);
logg(" PHP-CGI: Using %s", httpsettings.php_location);
// Read DEBUG_... setting from pihole-FTL.conf
// This option should be the last one as it causes
// some rather verbose output into the log when
+1
View File
@@ -56,6 +56,7 @@ typedef struct {
typedef struct httpsettings {
char *webroot;
char *webhome;
const char *php_location;
const char *acl;
bool api_auth_for_localhost;
bool prettyJSON;