Skip to content

Commit 5d7e885

Browse files
committed
Remove support for EOL Apache 2.0 and 2.2 in favor of 2.4+
Apache 2.2 has been marked as EOL in December 2017 and doesn't receive security patches any longer. Also, most *nix distributions and packages mostly support 2.4 as minimum by now. On Windows, this removes the configure option --enable-apache2-2handler and merges the --enable-apache2handler and --enable-apache2-4handler into a single option with favoring the --enable-apache2handler. - The upstream MODULE_MAGIC_NUMBER is deprecated in favor of MODULE_MAGIC_NUMBER_MAJOR in apache2/ap_mmn.h - The initial upstream MODULE_MAGIC_NUMBER_MAJOR was 20111025 in Apache 2.4.0 version. - APLOG_USE_MODULE is always available since Apache 2.3.6 - CORE_PRIVATE is unnecessary and ignored since Apache 2.4.0 See: https://forum.apachehaus.com/news-general-discussion/apache-2-2-users-your-time-is-running-out/
1 parent 212b283 commit 5d7e885

File tree

10 files changed

+37
-91
lines changed

10 files changed

+37
-91
lines changed

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ PHP 8.4 UPGRADE NOTES
363363
3. Changes in SAPI modules
364364
========================================
365365

366+
- apache2handler
367+
. Support for EOL Apache 2.0 and 2.2 has been removed. Minimum required Apache
368+
version is now 2.4.
369+
366370
========================================
367371
4. Deprecated Functionality
368372
========================================

UPGRADING.INTERNALS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ PHP 8.4 INTERNALS UPGRADE NOTES
158158
once used (use with_pear variable name).
159159

160160
c. Windows build system changes
161-
- The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have
162-
been removed.
161+
- The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19,
162+
--enable-apache2-2handler have been removed.
163+
- The configure option --enable-apache2-4handler is now an alias for the
164+
preferred --enable-apache2handler.
163165
- Added Bison flag '-Wall' when generating lexer files as done in *nix build
164166
system.
165167
- HAVE_WIN32_NATIVE_THREAD, USE_WIN32_NATIVE_THREAD, ENABLE_THREADS symbols

configure.ac

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,8 +1857,7 @@ if test -n "\$REDO_ALL"; then
18571857
AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_CLI_STATIC" > main/internal_functions_cli.c
18581858
18591859
if test "$PHP_SAPI" = "apache2handler"; then
1860-
if test "$APACHE_VERSION" -ge 2004001; then
1861-
if test -z "$APACHE_THREADED_MPM"; then
1860+
if test -z "$APACHE_THREADED_MPM"; then
18621861
cat <<X
18631862
+--------------------------------------------------------------------+
18641863
| *** WARNING *** |
@@ -1867,7 +1866,6 @@ cat <<X
18671866
| If you change Apache to use a threaded MPM you must reconfigure |
18681867
| PHP with --enable-zts |
18691868
X
1870-
fi
18711869
fi
18721870
fi
18731871

ext/standard/credits_sapi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
*/
1212

13-
CREDIT_LINE("Apache 2.0 Handler", "Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)");
13+
CREDIT_LINE("Apache 2 Handler", "Ian Holsman, Justin Erenkrantz (based on Apache 2 Filter code)");
1414
CREDIT_LINE("CGI / FastCGI", "Rasmus Lerdorf, Stig Bakken, Shane Caraveo, Dmitry Stogov");
1515
CREDIT_LINE("CLI", "Edin Kadribasic, Marcus Boerger, Johannes Schlueter, Moriyoshi Koizumi, Xinchen Hui");
1616
CREDIT_LINE("Embed", "Edin Kadribasic");

sapi/apache2handler/CREDITS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Apache 2.0 Handler
2-
Ian Holsman, Justin Erenkrantz (based on Apache 2.0 Filter code)
1+
Apache 2 Handler
2+
Ian Holsman, Justin Erenkrantz (based on Apache 2 Filter code)

sapi/apache2handler/config.m4

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if test "$PHP_APXS2" != "no"; then
3939
APU_BINDIR=`$APXS -q APU_BINDIR`
4040
APR_BINDIR=`$APXS -q APR_BINDIR`
4141

42-
dnl Pick up ap[ru]-N-config if using httpd >=2.1
42+
dnl Pick up ap[ru]-N-config.
4343
APR_CONFIG=`$APXS -q APR_CONFIG 2>/dev/null ||
4444
echo $APR_BINDIR/apr-config`
4545
APU_CONFIG=`$APXS -q APU_CONFIG 2>/dev/null ||
@@ -56,11 +56,12 @@ if test "$PHP_APXS2" != "no"; then
5656

5757
APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
5858

59-
dnl Test that we're trying to configure with apache 2.x
60-
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
61-
if test "$APACHE_VERSION" -lt 2000044; then
62-
AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
63-
fi
59+
dnl Check Apache version.
60+
PHP_AP_EXTRACT_VERSION([$APXS_HTTPD])
61+
AS_VERSION_COMPARE([$APACHE_VERSION], [2004000], [
62+
AC_MSG_RESULT([aborting])
63+
AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])
64+
])
6465

6566
APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
6667
if test -z `$APXS -q SYSCONFDIR`; then
@@ -107,17 +108,8 @@ if test "$PHP_APXS2" != "no"; then
107108
;;
108109
esac
109110

110-
if test "$APACHE_VERSION" -lt 2004001; then
111-
APXS_MPM=`$APXS -q MPM_NAME`
112-
if test "$APXS_MPM" != "prefork" && test "$APXS_MPM" != "peruser" && test "$APXS_MPM" != "itk"; then
113-
PHP_BUILD_THREAD_SAFE
114-
fi
115-
else
116-
APACHE_THREADED_MPM=`$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes'`
117-
if test -n "$APACHE_THREADED_MPM"; then
118-
PHP_BUILD_THREAD_SAFE
119-
fi
120-
fi
111+
APACHE_THREADED_MPM=$($APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes')
112+
AS_VAR_SET_IF([APACHE_THREADED_MPM], [PHP_BUILD_THREAD_SAFE])
121113
AC_MSG_RESULT(yes)
122114
PHP_SUBST(APXS)
123115
else

sapi/apache2handler/config.w32

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,24 @@
11
// vim:ft=javascript
22

3-
ARG_ENABLE('apache2handler', 'Build Apache 2.x handler', 'no');
3+
ARG_ENABLE('apache2handler', 'Build Apache 2 handler', 'no');
4+
ARG_ENABLE('apache2-4handler', 'Build Apache 2 handler (alias for --enable--apache2handler)', 'no');
45

5-
if (PHP_APACHE2HANDLER != "no") {
6-
if (PHP_ZTS == "no") {
7-
WARNING("Apache 2.0 module requires an --enable-zts build of PHP on windows");
8-
} else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2HANDLER", PHP_PHP_BUILD + "\\include\\apache2") &&
9-
CHECK_LIB("libhttpd.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
10-
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
11-
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
12-
) {
13-
SAPI('apache2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
14-
'php' + PHP_VERSION + 'apache2.dll',
15-
'/D PHP_APACHE2_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
16-
} else {
17-
WARNING("Could not find apache2 libraries/headers");
18-
}
6+
if(PHP_APACHE2_4HANDLER) {
7+
PHP_APACHE2HANDLER="yes";
198
}
209

21-
ARG_ENABLE('apache2-2handler', 'Build Apache 2.2.x handler', 'no');
22-
23-
if (PHP_APACHE2_2HANDLER != "no") {
24-
if (PHP_ZTS == "no") {
25-
WARNING("Apache 2.2 module requires an --enable-zts build of PHP on windows");
26-
} else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2_2HANDLER", PHP_PHP_BUILD + "\\include\\apache2_2") &&
27-
CHECK_LIB("libhttpd.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
28-
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
29-
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
30-
) {
31-
SAPI('apache2_2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
32-
'php' + PHP_VERSION + 'apache2_2.dll',
33-
'/D PHP_APACHE2_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
34-
'sapi\\apache2_2handler');
35-
} else {
36-
WARNING("Could not find apache2.2 libraries/headers");
37-
}
38-
}
39-
40-
ARG_ENABLE('apache2-4handler', 'Build Apache 2.4.x handler', 'no');
41-
if (PHP_APACHE2_4HANDLER != "no") {
10+
if (PHP_APACHE2HANDLER != "no") {
4211
if (PHP_ZTS == "no") {
43-
WARNING("Apache 2.4 module requires an --enable-zts build of PHP on windows");
44-
} else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2_4HANDLER", PHP_PHP_BUILD + "\\include\\apache2_4") &&
45-
CHECK_LIB("libhttpd.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
46-
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
47-
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
12+
WARNING("Apache module requires an --enable-zts build of PHP on windows");
13+
} else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2HANDLER", PHP_PHP_BUILD + "\\include\\apache2_4") &&
14+
CHECK_LIB("libhttpd.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
15+
CHECK_LIB("libapr-1.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
16+
CHECK_LIB("libaprutil-1.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
4817
) {
49-
SAPI('apache2_4handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
18+
SAPI('apache2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
5019
'php' + PHP_VERSION + 'apache2_4.dll',
51-
'/D PHP_APACHE2_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
52-
'sapi\\apache2handler');
20+
'/D PHP_APACHE2_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
5321
} else {
54-
WARNING("Could not find apache 2.4 libraries/headers");
22+
WARNING("Could not find Apache libraries/headers");
5523
}
5624
}

sapi/apache2handler/php_apache.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
#include "php.h"
2626
#include "main/php_streams.h"
2727

28-
/* Enable per-module logging in Apache 2.4+ */
29-
#ifdef APLOG_USE_MODULE
28+
/* Enable per-module logging. */
3029
APLOG_USE_MODULE(php);
31-
#endif
3230

3331
/* Declare this so we can get to it from outside the sapi_apache2.c file */
3432
extern module AP_MODULE_DECLARE_DATA php_module;

sapi/apache2handler/php_functions.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "php_ini.h"
3030
#include "SAPI.h"
3131

32-
#define CORE_PRIVATE
3332
#include "apr_strings.h"
3433
#include "apr_time.h"
3534
#include "ap_config.h"
@@ -141,9 +140,6 @@ PHP_FUNCTION(apache_lookup_uri)
141140
ADD_STRING(method);
142141
ADD_TIME(mtime);
143142
ADD_LONG(clength);
144-
#if MODULE_MAGIC_NUMBER < 20020506
145-
ADD_STRING(boundary);
146-
#endif
147143
ADD_STRING(range);
148144
ADD_LONG(chunked);
149145
ADD_STRING(content_type);
@@ -319,11 +315,7 @@ PHP_FUNCTION(apache_getenv)
319315

320316
static char *php_apache_get_version(void)
321317
{
322-
#if MODULE_MAGIC_NUMBER_MAJOR >= 20060905
323318
return (char *) ap_get_server_banner();
324-
#else
325-
return (char *) ap_get_server_version();
326-
#endif
327319
}
328320

329321
/* {{{ Fetch Apache version */
@@ -367,11 +359,7 @@ PHP_MINFO_FUNCTION(apache)
367359
char *p;
368360
server_rec *serv = ((php_struct *) SG(server_context))->r->server;
369361
#ifndef PHP_WIN32
370-
# if MODULE_MAGIC_NUMBER_MAJOR >= 20081201
371362
AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
372-
# else
373-
AP_DECLARE_DATA extern unixd_config_rec unixd_config;
374-
# endif
375363
#endif
376364

377365
for (n = 0; ap_loaded_modules[n]; ++n) {
@@ -395,7 +383,7 @@ PHP_MINFO_FUNCTION(apache)
395383
if (apv && *apv) {
396384
php_info_print_table_row(2, "Apache Version", apv);
397385
}
398-
snprintf(tmp, sizeof(tmp), "%d", MODULE_MAGIC_NUMBER);
386+
snprintf(tmp, sizeof(tmp), "%d", MODULE_MAGIC_NUMBER_MAJOR);
399387
php_info_print_table_row(2, "Apache API Version", tmp);
400388

401389
if (serv->server_admin && *(serv->server_admin)) {
@@ -406,11 +394,7 @@ PHP_MINFO_FUNCTION(apache)
406394
php_info_print_table_row(2, "Hostname:Port", tmp);
407395

408396
#ifndef PHP_WIN32
409-
#if MODULE_MAGIC_NUMBER_MAJOR >= 20081201
410397
snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
411-
#else
412-
snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
413-
#endif
414398
php_info_print_table_row(2, "User/Group", tmp);
415399
#endif
416400

sapi/apache2handler/sapi_apache2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int php_apache2_startup(sapi_module_struct *sapi_module)
388388

389389
static sapi_module_struct apache2_sapi_module = {
390390
"apache2handler",
391-
"Apache 2.0 Handler",
391+
"Apache 2 Handler",
392392

393393
php_apache2_startup, /* startup */
394394
php_module_shutdown_wrapper, /* shutdown */

0 commit comments

Comments
 (0)