git: e8d9493812a5 - main - lang/php8[01]: Make openssl as DEFAULT

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 12 Feb 2022 15:42:11 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e8d9493812a510f7c1cc94632836e1d5731de250

commit e8d9493812a510f7c1cc94632836e1d5731de250
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2022-02-12 15:38:24 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-02-12 15:41:51 +0000

    lang/php8[01]: Make openssl as DEFAULT
    
    After the 91fdbed776033fd4b210135429a171ab5fed549b commit fixing the
    issue for MySQL80 introduced another problem for the ports that depends
    on php8[01]-openssl port couldn't be built as the fix prevented
    php8[01]-openssl from being installed as it's already built with
    default php installation. As the problem has grown much bigger now and
    php80 is currently the DEFAULT php version so we are switching the
    behavior of php8[01] ports making the openssl module as default.
    
    - Remove non-default OPTION MYSQL80 from lang/php8[01]
    - Remove ports security/php8[01]-openssl
    - Remove OPTION OPENSSL from lang/php8[01]-extensions
    - Mark lang/php8[01] to IGNORE with libressl and libressl-devel
      Although php builds fine with those most of the extensions do not
      as they have dependency on curl. So mark it early.
    - OPTIONIZE lang/php80
    - Change openssl_DEPENDS to conditional for php74 only as this module
      is default from php80 with this commit. php74 do not have the issue
      where it fails to connect to MySQL80 due to new caching_sha2_password
    - Remove hash_DEPENDS from php.mk as it is a default module for all php
    - Change json_DEPENDS to conditional for php74 only as this module is
      default from php80
    
    PR:             261797 259793 252420
    Reported by:    sean@rogue-research.com martin@waschbuesch.de
    Approved by:    tz (private email) ale (private email)
    Sponsored by:   Bounce Experts
---
 MOVED                           |   2 +
 Mk/Uses/php.mk                  |  11 ++-
 UPDATING                        |  12 +++
 lang/php80-extensions/Makefile  |   8 +-
 lang/php80/Makefile             |  47 +++++------
 lang/php80/Makefile.ext         | 173 ++++++++++------------------------------
 lang/php81-extensions/Makefile  |   5 +-
 lang/php81/Makefile             |  66 +++++----------
 security/Makefile               |   2 -
 security/php80-openssl/Makefile |   9 ---
 security/php81-openssl/Makefile |   7 --
 11 files changed, 109 insertions(+), 233 deletions(-)

diff --git a/MOVED b/MOVED
index 9562b828a780..5fcc458dc83e 100644
--- a/MOVED
+++ b/MOVED
@@ -16889,3 +16889,5 @@ security/rubygem-devise-two-factor-rails60|security/rubygem-devise-two-factor-ra
 korean/nanumcoding-ttf|korean/nanum-gothic-coding|2022-02-10|Renamed to match upstream naming
 korean/nanumfonts-otf|korean/nanumfonts|2022-02-10|Split into multiple ports, use korean/nanumfonts meta-port instead
 korean/nanumfonts-ttf|korean/nanumfonts|2022-02-10|Split into multiple ports, use korean/nanumfonts meta-port instead
+security/php80-openssl||2022-02-12|php80-openssl module is a default module for lang/php80 from now on
+security/php81-openssl||2022-02-12|php81-openssl module is a default module for lang/php81 from now on
diff --git a/Mk/Uses/php.mk b/Mk/Uses/php.mk
index baad1f7790a3..45506538273d 100644
--- a/Mk/Uses/php.mk
+++ b/Mk/Uses/php.mk
@@ -178,17 +178,17 @@ PHP_VER=	${FLAVOR:S/^php//}
 # Mk/bsd.default-versions.mk in sync.
 .    if ${PHP_VER} == 81
 PHP_EXT_DIR=   20210902
-PHP_EXT_INC=    hash json pcre spl
+PHP_EXT_INC=    hash json openssl pcre spl
 .    elif ${PHP_VER} == 80
 PHP_EXT_DIR=   20200930
-PHP_EXT_INC=    hash json pcre spl
+PHP_EXT_INC=    hash json openssl pcre spl
 .    elif ${PHP_VER} == 74
 PHP_EXT_DIR=   20190902
 PHP_EXT_INC=    hash pcre spl
 .    else
 # (rene) default to DEFAULT_VERSIONS
 PHP_EXT_DIR=   20200930
-PHP_EXT_INC=    hash json pcre spl
+PHP_EXT_INC=    hash json openssl pcre spl
 .    endif
 
 # Try to figure out what the PHP_EXT_DIR should be WRT the
@@ -403,12 +403,13 @@ ftp_DEPENDS=	ftp/php${PHP_VER}-ftp
 gd_DEPENDS=	graphics/php${PHP_VER}-gd
 gettext_DEPENDS=devel/php${PHP_VER}-gettext
 gmp_DEPENDS=	math/php${PHP_VER}-gmp
-hash_DEPENDS=	security/php${PHP_VER}-hash
 iconv_DEPENDS=	converters/php${PHP_VER}-iconv
 igbinary_DEPENDS=	converters/pecl-igbinary@${PHP_FLAVOR}
 imap_DEPENDS=	mail/php${PHP_VER}-imap
 intl_DEPENDS=	devel/php${PHP_VER}-intl
+.if ${PHP_VER} < 80
 json_DEPENDS=	devel/php${PHP_VER}-json
+.endif
 ldap_DEPENDS=	net/php${PHP_VER}-ldap
 mbstring_DEPENDS=	converters/php${PHP_VER}-mbstring
 mcrypt_DEPENDS=	security/pecl-mcrypt@${PHP_FLAVOR}
@@ -418,7 +419,9 @@ mssql_DEPENDS=	databases/php${PHP_VER}-mssql
 mysqli_DEPENDS=	databases/php${PHP_VER}-mysqli
 odbc_DEPENDS=	databases/php${PHP_VER}-odbc
 opcache_DEPENDS=	www/php${PHP_VER}-opcache
+.if ${PHP_VER} < 80
 openssl_DEPENDS=security/php${PHP_VER}-openssl
+.endif
 pcntl_DEPENDS=	devel/php${PHP_VER}-pcntl
 pdf_DEPENDS=	print/pecl-pdflib@${PHP_FLAVOR}
 pdo_DEPENDS=	databases/php${PHP_VER}-pdo
diff --git a/UPDATING b/UPDATING
index a0dd960a30ab..3b39b777636c 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,18 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20220212:
+  AFFECTS: users of lang/php8[01][-extensions]?
+  AUTHOR: bofh@FreeBSD.org
+
+  Non-Default OPTION MYSQL80 has been removed in lieu of making
+  php8[01]-openssl as part of DEFAULT php8[01] installation. Although
+  for php74 it is not the case. Ports that depends on
+  security/php8[01]-openssl will no longer be installed as these have
+  been removed. There is no side effect of this for ports which have
+  USE_PHP=openssl. In case for php74 as the default php74-openssl will
+  be installed otherwise it will be used from php installation.
+
 20220207:
   AFFECTS: users of security/amavisd-new
   AUTHOR: flo@FreeBSD.org
diff --git a/lang/php80-extensions/Makefile b/lang/php80-extensions/Makefile
index 242066b11c9b..666b9abf44a7 100644
--- a/lang/php80-extensions/Makefile
+++ b/lang/php80-extensions/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	php80
-PORTVERSION=	1.0
+PORTVERSION=	1.1
 CATEGORIES=	lang
 PKGNAMESUFFIX=	-extensions
 
@@ -12,9 +12,8 @@ IGNORE_WITH_PHP=	74 81
 
 OPTIONS_DEFINE=	BCMATH BZ2 CALENDAR CTYPE CURL DBA \
 		DOM ENCHANT EXIF FILEINFO FILTER FTP GD GETTEXT \
-		GMP ICONV INTL IMAP LDAP MBSTRING \
-		MYSQLI \
-		ODBC OPCACHE OPENSSL PCNTL PDO PDO_DBLIB PDO_FIREBIRD \
+		GMP ICONV INTL IMAP LDAP MBSTRING MYSQLI \
+		ODBC OPCACHE PCNTL PDO PDO_DBLIB PDO_FIREBIRD \
 		PDO_MYSQL PDO_ODBC PDO_PGSQL PDO_SQLITE PGSQL PHAR POSIX \
 		PSPELL READLINE SESSION SHMOP SIMPLEXML SNMP SOAP \
 		SOCKETS SODIUM SQLITE3 SYSVMSG SYSVSEM SYSVSHM \
@@ -44,7 +43,6 @@ MBSTRING_DESC=		multibyte string support
 MYSQLI_DESC=		MySQLi database support
 ODBC_DESC=		ODBC support
 OPCACHE_DESC=		OPcache support
-OPENSSL_DESC=		OpenSSL support
 PCNTL_DESC=		pcntl support (CLI only)
 PDO_DESC=		PHP Data Objects Interface (PDO)
 PDO_DBLIB_DESC=		PDO DBLIB-DB driver
diff --git a/lang/php80/Makefile b/lang/php80/Makefile
index 940c5d9d106e..6049b8ee56c0 100644
--- a/lang/php80/Makefile
+++ b/lang/php80/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	php80
 DISTVERSION=	8.0.15
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES?=	lang devel www
 MASTER_SITES=	PHP
 DISTNAME=	php-${DISTVERSION}
@@ -12,6 +12,10 @@ COMMENT=	PHP Scripting Language
 LICENSE=	PHP301
 
 USES+=		compiler:c11 tar:xz cpe gnome pkgconfig
+# Although php builds fine with libressl* but most of the php modules
+# require curl which fails to build with libressl*. So do an early
+# check and prevent php from being built with libressl*
+IGNORE_SSL=	libressl libressl-devel
 CPE_PRODUCT=	php
 
 CONFLICTS_INSTALL?=	php[0-9][0-9]${PKGNAMESUFFIX}
@@ -21,20 +25,24 @@ LIB_DEPENDS=	libpcre2-8.so:devel/pcre2 \
 		libargon2.so:security/libargon2
 
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS+=--with-layout=GNU \
-		--with-config-file-scan-dir=${PREFIX}/etc/php \
+CONFIGURE_ARGS+=	\
 		--disable-all \
+		--program-prefix="" \
+		--with-config-file-scan-dir=${PREFIX}/etc/php \
+		--with-layout=GNU \
 		--with-libxml \
-		--with-password-argon2=${LOCALBASE} \
-		--program-prefix=""
-USES+=		autoreconf:build
+		--with-openssl \
+		--with-password-argon2=${LOCALBASE}
+
+USES+=		autoreconf:build ssl
 USE_GNOME=	libxml2
 
 CPPFLAGS=	-I${LOCALBASE}/include
+LDFLAGS=	-L${OPENSSLLIB} -lcrypto -lssl
 # PR230207 Allow relocations against read-only segments (override lld default)
 LDFLAGS_i386=	-Wl,-z,notext
 
-OPTIONS_DEFINE+=CLI CGI FPM EMBED PHPDBG DEBUG DTRACE IPV6 MYSQLND MYSQL80 LINKTHR ZTS
+OPTIONS_DEFINE+=CLI CGI FPM EMBED PHPDBG DEBUG DTRACE IPV6 MYSQLND LINKTHR ZTS
 OPTIONS_DEFAULT=CLI CGI FPM EMBED MYSQLND LINKTHR DTRACE
 OPTIONS_EXCLUDE_DragonFly=	DTRACE
 # ld(1) fails to link probes: Relocations in generic ELF (EM: 0)
@@ -58,7 +66,6 @@ CLI_DESC=	Build CLI version
 EMBED_DESC=	Build embedded library
 FPM_DESC=	Build FPM version
 LINKTHR_DESC=	Link thread lib (for threaded extensions)
-MYSQL80_DESC=	Build with MySQL caching password mechanism
 MYSQLND_DESC=	Build with MySQL Native Driver
 PHPDBG_DESC=	Interactive PHP debugger
 ZTS_DESC=	Force Zend Thread Safety (ZTS) build
@@ -77,12 +84,6 @@ FPM_CONFIGURE_ON=--enable-fpm \
 FPM_VARS=	PHP_SAPI+=fpm USE_RC_SUBR+=php-fpm
 IPV6_CONFIGURE_OFF=--disable-ipv6
 LINKTHR_LIBS=		-lpthread
-MYSQL80_USES=		ssl
-MYSQL80_CONFIGURE_ON=	--with-openssl
-MYSQL80_CONFIGURE_ENV=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-				OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-				PHP_OPENSSL=no
-MYSQL80_LDFLAGS=	-L${OPENSSLLIB} -lcrypto -lssl
 MYSQLND_CONFIGURE_ON=--enable-mysqlnd
 PHPDBG_CONFIGURE_ON=--enable-phpdbg
 PHPDBG_VARS=	PHP_SAPI+=phpdbg
@@ -123,15 +124,10 @@ PLIST_SUB+=	SAPI_INC="@comment "
 .endif
 
 CONFIGURE_ENV+=	ac_cv_decimal_fp_supported="no" \
-		lt_cv_path_SED="sed"
-
-.if ${PORT_OPTIONS:MMYSQL80}
-WARNING=	"PHP is now built with MySQL 8.0 support which has caching password mechanism. \
-	This implies php80-openssl module. Hence php80-openssl can no longer be \
-	installed alongside with php80. If you require php80-openssl module please \
-	rebuild php80 with MYSQL80 OPTION disabled. Otherwise remove php80-openssl \
-	DEPENDENCY from ports."
-.endif
+		lt_cv_path_SED="sed" \
+		OPENSSL_CFLAGS="-I${OPENSSLINC}" \
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
+		PHP_OPENSSL=yes
 
 post-patch:
 	@${TOUCH} ${WRKSRC}/ext/php_config.h
@@ -151,11 +147,6 @@ post-build:
 	@${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
 	@${ECHO_CMD} -n "PHP_EXT_DIR=" >> ${WRKDIR}/php.conf
 	@${SH} ${WRKSRC}/scripts/php-config --extension-dir | ${SED} -ne 's,^${PREFIX}/lib/php/,,p' >> ${WRKDIR}/php.conf
-
-post-build-MYSQL80-off:
-	@${ECHO_CMD} "PHP_EXT_INC=hash json pcre spl" >> ${WRKDIR}/php.conf
-
-post-build-MYSQL80-on:
 	@${ECHO_CMD} "PHP_EXT_INC=hash json openssl pcre spl" >> ${WRKDIR}/php.conf
 
 test: build
diff --git a/lang/php80/Makefile.ext b/lang/php80/Makefile.ext
index a1c1228785f4..1ec7953be95e 100644
--- a/lang/php80/Makefile.ext
+++ b/lang/php80/Makefile.ext
@@ -3,7 +3,7 @@ COMMENT=	The ${PHP_MODNAME} shared extension for php
 USES+=	php:ext,noflavors
 PHP_MODNAME=	${PKGNAMESUFFIX:S/-//}
 PHP_VER=	80
-IGNORE_WITH_PHP= 72 73 74
+IGNORE_WITH_PHP= 74 81
 
 EXTSUBDIR=	${DISTNAME}/ext/${PHP_MODNAME}
 WRKSRC=		${WRKDIR}/${EXTSUBDIR}
@@ -52,6 +52,21 @@ INIFILE_DESC=	INI file support
 FLATFILE_DESC=	flatfile support
 LMDB_DESC=	LMDB database support
 
+CDB_CONFIGURE_OFF=--without-cdb
+DB4_CONFIGURE_ON=--with-db4=${LOCALBASE}
+DB4_USES=			bdb
+DB4_VARS=	WITH_BDB_HIGHEST=yes
+FLATFILE_CONFIGURE_OFF=--disable-flatfile
+GDBM_LIB_DEPENDS=	libgdbm.so:databases/gdbm
+GDBM_CONFIGURE_ON=--with-gdbm=${LOCALBASE}
+INIFILE_CONFIGURE_OFF=--disable-inifile
+LMDB_LIB_DEPENDS=	liblmdb.so:databases/lmdb
+LMDB_CONFIGURE_ON=	--with-lmdb=${LOCALBASE}
+QDBM_LIB_DEPENDS=	libqdbm.so:databases/qdbm
+QDBM_CONFIGURE_ON=--with-qdbm=${LOCALBASE}
+TOKYO_LIB_DEPENDS=	libtokyocabinet.so:databases/tokyocabinet
+TOKYO_CONFIGURE_ON=--with-tcadb=${LOCALBASE}
+
 PHP_HEADER_DIRS=	libcdb libflatfile libinifile
 .endif
 
@@ -94,8 +109,7 @@ CONFIGURE_ARGS+=--enable-filter \
 CONFIGURE_ARGS+=--enable-ftp
 
 CONFIGURE_ENV+=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-		PHP_OPENSSL=yes
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
 
 LDFLAGS+=	-L${OPENSSLLIB} -lcrypto -lssl
 USES+=		ssl pkgconfig
@@ -120,6 +134,12 @@ JIS_DESC=	Enable JIS-mapped Japanese font support
 WEBP_DESC=  Enable WebP image format support
 X11_DESC=	Enable XPM support
 
+JIS_CONFIGURE_ON=--enable-gd-jis-conv
+WEBP_CONFIGURE_ON=--with-webp
+WEBP_LIB_DEPENDS=   libwebp.so:graphics/webp
+X11_USES=		xorg
+X11_USE=	XORG=xpm
+X11_CONFIGURE_ON=--with-xpm
 .endif
 
 .if ${PHP_MODNAME} == "gettext"
@@ -148,13 +168,15 @@ OPTIONS_DEFAULT=PANDA
 CCLIENT_DESC=	Uses the original but unmaintained cclient
 PANDA_DESC=	Uses the forked panda-cclient instead of the original cclient
 
+PANDA_LIB_DEPENDS=	libc-client4.so.10:mail/panda-cclient
+PANDA_LIB_DEPENDS_OFF=	libc-client4.so.9:mail/cclient
+
 CONFIGURE_ARGS+=--with-imap=${LOCALBASE} \
 		--with-pcre-dir=${LOCALBASE} \
 		--with-imap-ssl=${OPENSSLBASE}
 
 CONFIGURE_ENV+=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-		PHP_OPENSSL=yes
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
   
 LDFLAGS+=	-L${OPENSSLLIB} -lcrypto -lssl
 USES+=		ssl
@@ -187,6 +209,10 @@ OPTIONS_DEFAULT=REGEX
 
 REGEX_DESC=	Enable multibyte regex support
 
+REGEX_CONFIGURE_OFF=--disable-mbregex
+REGEX_CONFIGURE_ON=--with-onig=${LOCALBASE}
+REGEX_LIB_DEPENDS=	libonig.so:devel/oniguruma
+
 PHP_HEADER_DIRS=libmbfl libmbfl/filters libmbfl/mbfl libmbfl/nls
 .endif
 
@@ -195,6 +221,10 @@ OPTIONS_DEFINE=	MYSQLND
 OPTIONS_DEFAULT=MYSQLND
 
 MYSQLND_DESC=	Use MySQL Native Driver
+
+MYSQLND_CONFIGURE_ON=--with-mysqli=mysqlnd
+MYSQLND_CONFIGURE_OFF=--with-mysqli=${LOCALBASE}/bin/mysql_config
+MYSQLND_USES_OFF=	mysql
 .endif
 
 .if ${PHP_MODNAME} == "odbc"
@@ -204,13 +234,6 @@ CONFIGURE_ARGS+=--enable-odbc \
 		--with-unixODBC=${LOCALBASE}
 .endif
 
-.if ${PHP_MODNAME} == "openssl"
-USES+=			ssl
-CONFIGURE_ARGS+=	--with-openssl
-CONFIGURE_ENV+=		OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-			OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
-.endif
-
 .if ${PHP_MODNAME} == "opcache"
 # This is needed by Zend extensions, keep before everything.
 PHP_MOD_PRIO=	10
@@ -234,6 +257,9 @@ USE_PHP=	pdo:build
 OPTIONS_DEFINE=	MSSQL
 
 MSSQL_DESC=	Enable Microsoft SQL Server support
+
+MSSQL_LIB_DEPENDS=	libsybdb.so:databases/freetds
+MSSQL_LIB_DEPENDS_OFF=	libct.so:databases/freetds
 .endif
 
 .if ${PHP_MODNAME} == "pdo_firebird"
@@ -256,6 +282,11 @@ OPTIONS_DEFAULT=MYSQLND
 
 MYSQLND_DESC=	Use MySQL Native Driver
 
+MYSQLND_CONFIGURE_ON=--with-pdo-mysql=mysqlnd
+MYSQLND_CONFIGURE_OFF=--with-pdo-mysql=${LOCALBASE} \
+		--with-zlib-dir=/usr
+MYSQLND_USES_OFF=	mysql
+
 USE_PHP=	pdo:build
 .endif
 
@@ -433,131 +464,15 @@ CONFIGURE_ARGS+=--with-zlib=/usr
 USES+=		pkgconfig
 .endif
 
-.include <bsd.port.options.mk>
-
-.if ${PHP_MODNAME} == "dba"
-.	if empty(PORT_OPTIONS:MCDB)
-CONFIGURE_ARGS+=--without-cdb
-.	endif
-.	if ${PORT_OPTIONS:MDB4}
-CONFIGURE_ARGS+=--with-db4=${LOCALBASE}
-
-USES+=			bdb
-WITH_BDB_HIGHEST=	yes
-.	endif
-.	if ${PORT_OPTIONS:MGDBM}
-LIB_DEPENDS+=	libgdbm.so:databases/gdbm
-
-CONFIGURE_ARGS+=--with-gdbm=${LOCALBASE}
-.	endif
-.	if ${PORT_OPTIONS:MQDBM}
-LIB_DEPENDS+=	libqdbm.so:databases/qdbm
-
-CONFIGURE_ARGS+=--with-qdbm=${LOCALBASE}
-.	endif
-.	if ${PORT_OPTIONS:MTOKYO}
-LIB_DEPENDS+=	libtokyocabinet.so:databases/tokyocabinet
-
-CONFIGURE_ARGS+=--with-tcadb=${LOCALBASE}
-.	endif
-.	if empty(PORT_OPTIONS:MINIFILE)
-CONFIGURE_ARGS+=--disable-inifile
-.	endif
-.	if empty(PORT_OPTIONS:MFLATFILE)
-CONFIGURE_ARGS+=--disable-flatfile
-.	endif
-
-.	if ${PORT_OPTIONS:MLMDB}
-LIB_DEPENDS+=	liblmdb.so:databases/lmdb
-CONFIGURE_ARGS+=	--with-lmdb=${LOCALBASE}
-.endif
-.endif
-
-.if ${PHP_MODNAME} == "mysqli"
-.	if ${PORT_OPTIONS:MMYSQLND}
-CONFIGURE_ARGS+=--with-mysqli=mysqlnd
-.	else
-CONFIGURE_ARGS+=--with-mysqli=${LOCALBASE}/bin/mysql_config
-USES+=	mysql
-.	endif
-.endif
-
-.if ${PHP_MODNAME} == "pdo_mysql"
-.	if ${PORT_OPTIONS:MMYSQLND}
-CONFIGURE_ARGS+=--with-pdo-mysql=mysqlnd
-.	else
-CONFIGURE_ARGS+=--with-pdo-mysql=${LOCALBASE} \
-		--with-zlib-dir=/usr
-USES+=	mysql
-.	endif
-.endif
-
-.if ${PHP_MODNAME} == "gd"
-.	if ${PORT_OPTIONS:MJIS}
-CONFIGURE_ARGS+=--enable-gd-jis-conv
-.	endif
-.   if ${PORT_OPTIONS:MWEBP}
-LIB_DEPENDS+=   libwebp.so:graphics/webp
-
-CONFIGURE_ARGS+=--with-webp
-.   endif
-.	if ${PORT_OPTIONS:MX11}
-USES+=		xorg
-USE_XORG=	xpm
-
-CONFIGURE_ARGS+=--with-xpm
-.	endif
-.endif
-
 .include <bsd.port.pre.mk>
 
-.if ${PHP_MODNAME} == "imap"
-.	if ${PORT_OPTIONS:MPANDA}
-LIB_DEPENDS+=	libc-client4.so.10:mail/panda-cclient
-.	else
-LIB_DEPENDS+=	libc-client4.so.9:mail/cclient
-.	endif
-.endif
-
-.if ${PHP_MODNAME} == "mbstring"
-.	if ${PORT_OPTIONS:MREGEX}
-LIB_DEPENDS+=	libonig.so:devel/oniguruma
-CONFIGURE_ARGS+=--with-onig=${LOCALBASE}
-.	else
-CONFIGURE_ARGS+=--disable-mbregex
-.	endif
-.endif
-
-.if ${PHP_MODNAME} == "openssl"
-post-stage:
-	@if ${PREFIX}/bin/php -m | grep openssl 2>/dev/null && ( [ ! -f ${PREFIX}/etc/php/ext-20-openssl.ini ] && [ ! -f ${PREFIX}/etc/php/ext-30-openssl.ini ] ); then \
-		${ECHO_CMD}; \
-		${ECHO_MSG} "===>  ${PKGNAME} "openssl module is already built with php base.; \
-		${ECHO_CMD}; \
-		${FALSE}; \
-	fi
-.endif
-
-.if ${PHP_MODNAME} == "openssl" || ${PHP_MODNAME} == "sqlite3"
+.if ${PHP_MODNAME} == "sqlite3" || ${PHP_MODNAME} == "zlib"
 post-extract:
 	@${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
 .endif
 
-.if ${PHP_MODNAME} == "pdo_dblib"
-.	if ${PORT_OPTIONS:MMSSQL}
-LIB_DEPENDS+=	libsybdb.so:databases/freetds
-.	else
-LIB_DEPENDS+=	libct.so:databases/freetds
-.	endif
-.endif
-
 .if ${PHP_MODNAME} == "xml"
 post-extract:
 	@${MKDIR} ${WRKSRC}/ext/xml
 	@${CP} ${WRKSRC}/expat_compat.h ${WRKSRC}/ext/xml
 .endif
-
-.if ${PHP_MODNAME} == "zlib"
-post-extract:
-	@${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
-.endif
diff --git a/lang/php81-extensions/Makefile b/lang/php81-extensions/Makefile
index 65db31e854fb..da9da0e63f1e 100644
--- a/lang/php81-extensions/Makefile
+++ b/lang/php81-extensions/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	php81
-PORTVERSION=	1.0
+PORTVERSION=	1.1
 CATEGORIES=	lang
 PKGNAMESUFFIX=	-extensions
 
@@ -13,7 +13,7 @@ IGNORE_WITH_PHP=	74 80
 
 OPTIONS_DEFINE=		BCMATH BZ2 CALENDAR CTYPE CURL DBA DOM ENCHANT EXIF FFI \
 			FILEINFO FILTER FTP GD GETTEXT GMP ICONV IMAP INTL LDAP \
-			MBSTRING MYSQLI ODBC OPCACHE OPENSSL PCNTL PDO \
+			MBSTRING MYSQLI ODBC OPCACHE PCNTL PDO \
 			PDO_DBLIB PDO_FIREBIRD PDO_MYSQL PDO_ODBC PDO_PGSQL \
 			PDO_SQLITE PGSQL PHAR POSIX PSPELL READLINE SESSION \
 			SHMOP SIMPLEXML SNMP SOAP SOCKETS SODIUM SQLITE3 \
@@ -47,7 +47,6 @@ MBSTRING_DESC=		multibyte string support
 MYSQLI_DESC=		MySQLi database support
 ODBC_DESC=		ODBC support
 OPCACHE_DESC=		OPcache support
-OPENSSL_DESC=		OpenSSL support
 PCNTL_DESC=		pcntl support (CLI only)
 PDO_DBLIB_DESC=		PDO DBLIB-DB driver
 PDO_DESC=		PHP Data Objects Interface (PDO)
diff --git a/lang/php81/Makefile b/lang/php81/Makefile
index 4206fea49ec7..e0d59649dad0 100644
--- a/lang/php81/Makefile
+++ b/lang/php81/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	php81
 DISTVERSION=	8.1.2
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES?=	lang devel www
 MASTER_SITES=	PHP/distributions
 DISTNAME=	php-${DISTVERSION}
@@ -11,6 +11,10 @@ COMMENT=	PHP Scripting Language (8.1.X branch)
 LICENSE=	PHP301
 
 USES+=		compiler:c11 cpe gnome pkgconfig tar:xz
+# Although php builds fine with libressl* but most of the php modules
+# require curl which fails to build with libressl*. So do an early
+# check and prevent php from being built with libressl*
+IGNORE_SSL=	libressl libressl-devel
 CPE_PRODUCT=	php
 PHP_VER=	81
 
@@ -26,19 +30,21 @@ CONFIGURE_ARGS+=	--disable-all \
 			--with-config-file-scan-dir=${PREFIX}/etc/php \
 			--with-layout=GNU \
 			--with-libxml \
+			--with-openssl \
 			--with-password-argon2=${LOCALBASE}
 DESTDIRNAME=		INSTALL_ROOT
 
-USES+=		autoreconf:build
+USES+=		autoreconf:build ssl
 USE_GNOME=	libxml2
 
 CPPFLAGS=	-I${LOCALBASE}/include
 
+LDFLAGS=	-L${OPENSSLLIB} -lcrypto -lssl
 # PR230207 Allow relocations against read-only segments (override lld default)
 LDFLAGS_i386=	-Wl,-z,notext
 
 OPTIONS_DEFINE+=		CGI CLI DEBUG DTRACE EMBED FPM IPV6 LINKTHR \
-				MYSQL80 MYSQLND PHPDBG ZTS
+				MYSQLND PHPDBG ZTS
 OPTIONS_DEFAULT=		CGI CLI DTRACE EMBED FPM LINKTHR MYSQLND
 OPTIONS_EXCLUDE_DragonFly=	DTRACE
 # ld(1) fails to link probes: Relocations in generic ELF (EM: 0)
@@ -62,7 +68,6 @@ CLI_DESC=	Build CLI version
 EMBED_DESC=	Build embedded library
 FPM_DESC=	Build FPM version
 LINKTHR_DESC=	Link thread lib (for threaded extensions)
-MYSQL80_DESC=	Build with MySQL caching password mechanism
 MYSQLND_DESC=	Build with MySQL Native Driver
 PHPDBG_DESC=	Interactive PHP debugger
 ZTS_DESC=	Force Zend Thread Safety (ZTS) build
@@ -82,12 +87,6 @@ FPM_VARS=		PHP_SAPI+=fpm \
 			USE_RC_SUBR+=php-fpm
 IPV6_CONFIGURE_OFF=	--disable-ipv6
 LINKTHR_LIBS=		-lpthread
-MYSQL80_USES=		ssl
-MYSQL80_CONFIGURE_ON=	--with-openssl
-MYSQL80_CONFIGURE_ENV=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-			OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-			PHP_OPENSSL=no
-MYSQL80_LDFLAGS=	-L${OPENSSLLIB} -lcrypto -lssl
 MYSQLND_CONFIGURE_ON=	--enable-mysqlnd
 PHPDBG_CONFIGURE_ON=	--enable-phpdbg
 PHPDBG_VARS=		PHP_SAPI+=phpdbg
@@ -126,11 +125,10 @@ PLIST_SUB+=	SAPI_INC="@comment "
 .endif
 
 CONFIGURE_ENV+=	ac_cv_decimal_fp_supported="no" \
-		lt_cv_path_SED="sed"
-
-.if ${PORT_OPTIONS:MMYSQL80}
-WARNING=	"PHP is now built with MySQL 8.0 support which has caching password mechanism. This implies ${PORTNAME}-openssl module. Hence ${PORTNAME}-openssl can no longer be installed alongside with ${PORTNAME}. If you require ${PORTNAME}-openssl module please rebuild ${PORTNAME} with MYSQL80 OPTION disabled. Otherwise remove ${PORTNAME}-openssl DEPENDENCY from ports."
-.endif
+		lt_cv_path_SED="sed" \
+		OPENSSL_CFLAGS="-I${OPENSSLINC}" \
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
+		PHP_OPENSSL=yes
 
 post-patch:
 	@${TOUCH} ${WRKSRC}/ext/php_config.h
@@ -150,11 +148,6 @@ post-build:
 	@${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
 	@${ECHO_CMD} -n "PHP_EXT_DIR=" >> ${WRKDIR}/php.conf
 	@${SH} ${WRKSRC}/scripts/php-config --extension-dir | ${SED} -ne 's,^${PREFIX}/lib/php/,,p' >> ${WRKDIR}/php.conf
-
-post-build-MYSQL80-off:
-	@${ECHO_CMD} "PHP_EXT_INC=hash json pcre spl" >> ${WRKDIR}/php.conf
-
-post-build-MYSQL80-on:
 	@${ECHO_CMD} "PHP_EXT_INC=hash json openssl pcre spl" >> ${WRKDIR}/php.conf
 
 test: build
@@ -281,8 +274,7 @@ CONFIGURE_ARGS+=	--enable-filter
 CONFIGURE_ARGS+=	--enable-ftp
 
 CONFIGURE_ENV+=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-		PHP_OPENSSL=yes
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
 
 LDFLAGS+=	-L${OPENSSLLIB} -lcrypto -lssl
 USES+=		pkgconfig ssl
@@ -345,9 +337,8 @@ CONFIGURE_ARGS+=	--with-imap-ssl=${OPENSSLBASE} \
 			--with-imap=${LOCALBASE}
 
 CONFIGURE_ENV+=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
-		PHP_OPENSSL=yes
-  
+		OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
+
 LDFLAGS+=	-L${OPENSSLLIB} -lcrypto -lssl
 USES+=		ssl
 .endif
@@ -389,7 +380,7 @@ OPTIONS_DEFINE=		MYSQLND
 OPTIONS_DEFAULT=	MYSQLND
 
 MYSQLND_DESC=		Use MySQL Native Driver
-MYSQLND_CONFIGURE_ARGS=	--with-mysqli=mysqlnd
+MYSQLND_CONFIGURE_ON=	--with-mysqli=mysqlnd
 MYSQLND_CONFIGURE_OFF=	--with-mysqli=${LOCALBASE}/bin/mysql_config
 MYSQLND_USES_OFF=	mysql
 .endif
@@ -401,13 +392,6 @@ CONFIGURE_ARGS+=	--enable-odbc \
 			--with-unixODBC=${LOCALBASE}
 .endif
 
-.if ${PHP_MODNAME} == "openssl"
-USES+=			ssl
-CONFIGURE_ARGS+=	--with-openssl
-CONFIGURE_ENV+=		OPENSSL_CFLAGS="-I${OPENSSLINC}" \
-			OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
-.endif
-
 .if ${PHP_MODNAME} == "opcache"
 # This is needed by Zend extensions, keep before everything.
 PHP_MOD_PRIO=		10
@@ -453,10 +437,11 @@ OPTIONS_DEFINE=		MYSQLND
 OPTIONS_DEFAULT=	MYSQLND
 
 MYSQLND_DESC=		Use MySQL Native Driver
+
 MYSQLND_CONFIGURE_OFF=	--with-pdo-mysql=${LOCALBASE} \
 			--with-zlib-dir=/usr
-MYSQLND_CONFIGURE_ON=	--with-pdo-mysql=mysqlnd
 MYSQLND_USES_OFF=	mysql
+MYSQLND_CONFIGURE_ON=	--with-pdo-mysql=mysqlnd
 
 USE_PHP=	pdo:build
 .endif
@@ -626,18 +611,7 @@ USES+=			pkgconfig
 
 .include <bsd.port.pre.mk>
 
-.if ${PHP_MODNAME} == "openssl"
-post-stage:
-	@if ${PREFIX}/bin/php -m | grep openssl 2>/dev/null && ( [ ! -f ${PREFIX}/etc/php/ext-20-openssl.ini ] && [ ! -f ${PREFIX}/etc/php/ext-30-openssl.ini ] ); then \
-		${ECHO_CMD}; \
-		${ECHO_MSG} "===>  ${PKGNAME} "openssl module is already built with php base.; \
-		${ECHO_CMD}; \
-		${FALSE}; \
-	fi
-.endif
-
-.if ${PHP_MODNAME} == "openssl" || ${PHP_MODNAME} == "sqlite3" || ${PHP_MODNAME} == \
-	"zlib"
+.if ${PHP_MODNAME} == "sqlite3" || ${PHP_MODNAME} == "zlib"
 post-extract:
 	@${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
 .endif
diff --git a/security/Makefile b/security/Makefile
index c5ed8e82e886..57c259cf7d52 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -802,10 +802,8 @@
     SUBDIR += php74-openssl
     SUBDIR += php74-sodium
     SUBDIR += php80-filter
-    SUBDIR += php80-openssl
     SUBDIR += php80-sodium
     SUBDIR += php81-filter
-    SUBDIR += php81-openssl
     SUBDIR += php81-sodium
     SUBDIR += phpsecinfo
     SUBDIR += picosha2
diff --git a/security/php80-openssl/Makefile b/security/php80-openssl/Makefile
deleted file mode 100644
index e0451b94e319..000000000000
--- a/security/php80-openssl/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-CATEGORIES=	security
-
-MASTERDIR=	${.CURDIR}/../../lang/php80
-
-PKGNAMESUFFIX=	-openssl
-
-TEST_TARGET=	test
-
-.include "${MASTERDIR}/Makefile"
diff --git a/security/php81-openssl/Makefile b/security/php81-openssl/Makefile
deleted file mode 100644
index 55f5c0e6a4e0..000000000000
--- a/security/php81-openssl/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-CATEGORIES=	security
-
-MASTERDIR=	${.CURDIR}/../../lang/php81
-
-PKGNAMESUFFIX=	-openssl
-
-.include "${MASTERDIR}/Makefile"