Skip to content

Commit f3392a5

Browse files
committed
sapi/apache2handler: Add --disable-apache2-conf configure option
Add a new --disable-apache2-conf option that prevents apxs from editing httpd.conf during installation. When SYSCONFDIR is non-empty, apxs is invoked with -a, which requires httpd.conf to exist at the target path. This fails when installing into a staging directory (INSTALL_ROOT) where no `httpd.conf` exists but apxs is present and works, and is also unwanted on distributions [like Debian][1] that manage Apache module activation separately (e.g. via a2enmod). [1]: https://salsa.debian.org/php-team/php/-/blob/9bd72dc78216cf136315d765ec3a602ac99e60e3/debian/patches/0030-Add-patch-to-install-php7-module-directly-to-APXS_LI.patch Assisted-by: Claude Sonnet 4.6
1 parent 4c027ea commit f3392a5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

sapi/apache2handler/config.m4

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ PHP_ARG_WITH([apxs2],
66
[no],
77
[no])
88

9+
PHP_ARG_ENABLE([apache2-conf],
10+
[whether to activate the PHP module in Apache httpd.conf via apxs],
11+
[AS_HELP_STRING([--disable-apache2-conf],
12+
[Do not activate the PHP module in the Apache httpd.conf during installation
13+
via apxs. Useful when installing into a staging directory or when Apache
14+
configuration is managed separately (e.g., via a2enmod).])],
15+
[yes],
16+
[no])
17+
918
if test "$PHP_APXS2" != "no"; then
1019
AS_VAR_IF([PHP_APXS2], [yes], [
1120
APXS=apxs
@@ -69,7 +78,7 @@ if test "$PHP_APXS2" != "no"; then
6978
[AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])])
7079

7180
APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)
72-
if test -z $($APXS -q SYSCONFDIR); then
81+
if test -z $($APXS -q SYSCONFDIR) || test "$PHP_APACHE2_CONF" = "no"; then
7382
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
7483
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
7584
-i -n php"

0 commit comments

Comments
 (0)