mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Add PHP support in Pi-hole' HTTP server.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user