aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammad Moinur Rahman <bofh@FreeBSD.org>2023-12-05 17:20:34 +0000
committerMuhammad Moinur Rahman <bofh@FreeBSD.org>2023-12-05 17:29:32 +0000
commit5acc30bdc24452e17fff0127122096bda42b1d18 (patch)
treea2da962548cee377c7ca9814926a48334e150898
parentec8b82ba10824fec2927643d1cecdbf2c17dd193 (diff)
lang/php81: Runtime fix
- php modules while build with system pcre fails to run when using apache httpd and mod_php. So OPTIONIZE and add as a non-DEFAULT option. However to my knowledge and experience I haven't faced this with nginx and php-fpm yet. [1] - There is another corner case with apache httpd and mod_php when run on 13.2-RELEASE or newer specially on versions where ASLR is by default turned on. All modules specialy opcache crashes httpd. So add a warning message to advise users to move into php-fpm. [2] Thanks to brnrd@ for the patch. [2] PR: 275522 [1], 268318 [2] Reported by: majo-bugs.freebsd.org@cerny.sk [1], zarychtam@plan-b.pwste.edu.pl [2]
-rw-r--r--lang/php81/Makefile15
-rw-r--r--lang/php81/pkg-message.mod15
-rw-r--r--lang/php81/pkg-plist7
3 files changed, 27 insertions, 10 deletions
diff --git a/lang/php81/Makefile b/lang/php81/Makefile
index fa756234327b..e340f547fbd9 100644
--- a/lang/php81/Makefile
+++ b/lang/php81/Makefile
@@ -1,5 +1,6 @@
PORTNAME= php81
DISTVERSION= 8.1.26
+PORTREVISION= 1
CATEGORIES?= lang devel www
MASTER_SITES= PHP/distributions
DISTNAME= php-${DISTVERSION}
@@ -17,7 +18,6 @@ PHP_VER= 81
CONFLICTS_INSTALL?= php[0-9][0-9]${PKGNAMESUFFIX}
.if !defined(PKGNAMESUFFIX)
-BUILD_DEPENDS= re2c>0:devel/re2c
LIB_DEPENDS= libargon2.so:security/libargon2 \
libpcre2-8.so:devel/pcre2
@@ -28,8 +28,7 @@ CONFIGURE_ARGS+= --disable-all \
--with-layout=GNU \
--with-libxml \
--with-openssl \
- --with-password-argon2=${LOCALBASE} \
- --with-external-pcre=${LOCALBASE}
+ --with-password-argon2=${LOCALBASE}
USES+= autoreconf:build ssl
USE_GNOME= libxml2
@@ -39,8 +38,8 @@ LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
LDFLAGS_i386+= -Wl,-z,notext
OPTIONS_DEFINE+= CGI CLI DEBUG DTRACE EMBED FPM IPV6 LINKTHR \
- MYSQLND PHPDBG ZTS
-OPTIONS_DEFAULT= CGI CLI DTRACE EMBED FPM LINKTHR MYSQLND
+ MYSQLND PCRE PHPDBG ZTS
+OPTIONS_DEFAULT= CGI CLI DTRACE EMBED FPM LINKTHR MYSQLND PCRE
OPTIONS_EXCLUDE_DragonFly= DTRACE
# ld(1) fails to link probes: Relocations in generic ELF (EM: 0)
OPTIONS_EXCLUDE_aarch64= DTRACE
@@ -63,6 +62,7 @@ EMBED_DESC= Build embedded library
FPM_DESC= Build FPM version
LINKTHR_DESC= Link thread lib (for threaded extensions)
MYSQLND_DESC= Build with MySQL Native Driver
+PCRE_DESC= Use system pcre instead of bundled one
PHPDBG_DESC= Interactive PHP debugger
ZTS_DESC= Force Zend Thread Safety (ZTS) build
@@ -82,6 +82,10 @@ FPM_VARS= PHP_SAPI+=fpm \
IPV6_CONFIGURE_OFF= --disable-ipv6
LINKTHR_LIBS= -lpthread
MYSQLND_CONFIGURE_ON= --enable-mysqlnd
+PCRE_BUILD_DEPENDS= re2c>0:devel/re2c
+PCRE_CONFIGURE_ON= --with-external-pcre=${LOCALBASE}
+PCRE_PLIST_SUB= BUNDLED_PCRE="@comment "
+PCRE_PLIST_SUB_OFF= BUNDLED_PCRE=""
PHPDBG_CONFIGURE_ON= --enable-phpdbg
PHPDBG_VARS= PHP_SAPI+=phpdbg
ZTS_CONFIGURE_ON= --enable-zts
@@ -96,6 +100,7 @@ PKGMESSAGE= ${PKGDIR}/pkg-message.mod
MODULENAME= libphp
SHORTMODNAME= php
WARNING= "!!! If you have a threaded Apache, you must build ${PHP_PORT} with ZTS support to enable thread-safety in extensions !!!"
+WARNING+= "!!! Consider switching to php-fpm and mod_proxy_fcgi as per Apache httpd recommendations !!!"
.endif
.include <bsd.port.pre.mk>
diff --git a/lang/php81/pkg-message.mod b/lang/php81/pkg-message.mod
index a0c2c87889a7..8ad98d25b4e6 100644
--- a/lang/php81/pkg-message.mod
+++ b/lang/php81/pkg-message.mod
@@ -1,5 +1,15 @@
******************************************************************************
+Consider switching to php-fpm and mod_fast_cgi as per Apache httpd project
+recommendation. See https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM
+
+******************************************************************************
+
+If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
+add WITH_MPM=event to /etc/make.conf to prevent build failures.
+
+******************************************************************************
+
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
@@ -12,8 +22,3 @@ You should add the following to your Apache configuration file:
</FilesMatch>
******************************************************************************
-
-If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
-add WITH_MPM=event to /etc/make.conf to prevent build failures.
-
-******************************************************************************
diff --git a/lang/php81/pkg-plist b/lang/php81/pkg-plist
index 94ef315fa1a8..bf8a092bc4cb 100644
--- a/lang/php81/pkg-plist
+++ b/lang/php81/pkg-plist
@@ -162,6 +162,13 @@ include/php/ext/libxml/php_libxml.h
%%MYSQLND%%include/php/ext/mysqlnd/mysqlnd_vio.h
%%MYSQLND%%include/php/ext/mysqlnd/mysqlnd_wireprotocol.h
%%MYSQLND%%include/php/ext/mysqlnd/php_mysqlnd.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/config.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2_internal.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2_intmodedep.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2_jit_neon_inc.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2_jit_simd_inc.h
+%%BUNDLED_PCRE%%include/php/ext/pcre/pcre2lib/pcre2_ucp.h
include/php/ext/pcre/php_pcre.h
include/php/ext/spl/php_spl.h
include/php/ext/spl/spl_array.h