@@ -22,6 +22,47 @@ function apache_get_version(): string
22
22
}
23
23
24
24
25
+ /**
26
+ * Retrieve an Apache environment variable specified by
27
+ * variable.
28
+ *
29
+ * This function requires Apache 2 otherwise it's undefined.
30
+ *
31
+ * @param string $variable The Apache environment variable
32
+ * @param bool $walk_to_top Whether to get the top-level variable available to all Apache layers.
33
+ * @return string The value of the Apache environment variable on success,
34
+ * @throws ApacheException
35
+ *
36
+ */
37
+ function apache_getenv (string $ variable , bool $ walk_to_top = false ): string
38
+ {
39
+ error_clear_last ();
40
+ $ result = \apache_getenv ($ variable , $ walk_to_top );
41
+ if ($ result === false ) {
42
+ throw ApacheException::createFromPhpError ();
43
+ }
44
+ return $ result ;
45
+ }
46
+
47
+
48
+ /**
49
+ * Fetches all HTTP request headers from the current request.
50
+ *
51
+ * @return array An associative array of all the HTTP headers in the current request, .
52
+ * @throws ApacheException
53
+ *
54
+ */
55
+ function apache_request_headers (): array
56
+ {
57
+ error_clear_last ();
58
+ $ result = \apache_request_headers ();
59
+ if ($ result === false ) {
60
+ throw ApacheException::createFromPhpError ();
61
+ }
62
+ return $ result ;
63
+ }
64
+
65
+
25
66
/**
26
67
* apache_reset_timeout resets the Apache write timer,
27
68
* which defaults to 300 seconds. With set_time_limit(0);
@@ -81,3 +122,52 @@ function apache_setenv(string $variable, string $value, bool $walk_to_top = fals
81
122
throw ApacheException::createFromPhpError ();
82
123
}
83
124
}
125
+
126
+
127
+ /**
128
+ * Fetches all HTTP headers from the current request.
129
+ *
130
+ * This function is an alias for apache_request_headers.
131
+ * Please read the apache_request_headers
132
+ * documentation for more information on how this function works.
133
+ *
134
+ * @return array An associative array of all the HTTP headers in the current request, .
135
+ * @throws ApacheException
136
+ *
137
+ */
138
+ function getallheaders (): array
139
+ {
140
+ error_clear_last ();
141
+ $ result = \getallheaders ();
142
+ if ($ result === false ) {
143
+ throw ApacheException::createFromPhpError ();
144
+ }
145
+ return $ result ;
146
+ }
147
+
148
+
149
+ /**
150
+ * virtual is an Apache-specific function which
151
+ * is similar to <!--#include virtual...--> in
152
+ * mod_include.
153
+ * It performs an Apache sub-request. It is useful for including
154
+ * CGI scripts or .shtml files, or anything else that you would
155
+ * parse through Apache. Note that for a CGI script, the script
156
+ * must generate valid CGI headers. At the minimum that means it
157
+ * must generate a Content-Type header.
158
+ *
159
+ * To run the sub-request, all buffers are terminated and flushed to the
160
+ * browser, pending headers are sent too.
161
+ *
162
+ * @param string $filename The file that the virtual command will be performed on.
163
+ * @throws ApacheException
164
+ *
165
+ */
166
+ function virtual (string $ filename ): void
167
+ {
168
+ error_clear_last ();
169
+ $ result = \virtual ($ filename );
170
+ if ($ result === false ) {
171
+ throw ApacheException::createFromPhpError ();
172
+ }
173
+ }
0 commit comments