From odip@pierino.bionet.nsc.ru  Sun Oct  3 07:41:31 2004
Return-Path: <odip@pierino.bionet.nsc.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 728E216A4CE; Sun,  3 Oct 2004 07:41:31 +0000 (GMT)
Received: from pierino.bionet.nsc.ru (pierino.bionet.nsc.ru [193.125.179.50])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id A9FF543D1D; Sun,  3 Oct 2004 07:41:30 +0000 (GMT)
	(envelope-from odip@pierino.bionet.nsc.ru)
Received: from pierino.bionet.nsc.ru (localhost [127.0.0.1])
	by pierino.bionet.nsc.ru (8.12.8p1/8.12.8) with ESMTP id i937fSLt083696;
	Sun, 3 Oct 2004 14:41:28 +0700 (NOVST)
	(envelope-from odip@pierino.bionet.nsc.ru)
Received: (from odip@localhost)
	by pierino.bionet.nsc.ru (8.12.8p1/8.12.8/Submit) id i937fR6q083695;
	Sun, 3 Oct 2004 14:41:27 +0700 (NOVST)
	(envelope-from odip)
Message-Id: <200410030741.i937fR6q083695@pierino.bionet.nsc.ru>
Date: Sun, 3 Oct 2004 14:41:27 +0700 (NOVST)
From: Dmitry A Grigorovich <odip@bionet.nsc.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc: ale@freebsd.org
Subject: [PATCH] php4 openssl building static
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         72275
>Category:       ports
>Synopsis:       [PATCH] php4 openssl building static
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    ale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 03 07:50:26 GMT 2004
>Closed-Date:    Mon Mar 14 14:42:55 GMT 2005
>Last-Modified:  Mon Mar 14 14:42:55 GMT 2005
>Originator:     Dmitry A Grigorovich
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
ICiG SB RAS
>Environment:
System: FreeBSD pierino.bionet.nsc.ru 4.8-RELEASE FreeBSD 4.8-RELEASE #5: Sat Oct 4 02:28:14 NOVST 2003 root@pierino.bionet.nsc.ru:/usr/obj/usr/src/sys/ODIP i386

>Description:

php4 extension openssl when building shared does not work as necessary
1) http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71754
2) http://bugs.php.net/bug.php?id=29934

This can't be fixed because PHP4 BUG !

>How-To-Repeat:

File test.php

<?php
$fp = fsockopen( "ssl://example.com", 443, $errno, $errstr, $timeout = 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: example.com\r\n";
    $out .= "Connection: Close\r\n\r\n";

    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 4096);
    }
    fclose($fp);
}
?>

Place test.php on web
Show test.php via browser
You are get error 0 !

Remove 'ssl://' and change 443 into 80 - all is ok

>Fix:

We need fix many things:

1) Never using php4-openssl
2) Don't break ports in which USE_PHP=openssl
3) Fix mod_php4 to building openssl static

To fix problem:

1) Remove ports php4-extensions, php4-<EXTNAME>, mod_php4
2) Patch ports with follow patch
3) Install mod_php4, php4-extensions
   Don't try install php4-openssl - it's not needed !

--- php4-openssl-static.patch begins here ---
--- Mk/bsd.php.mk.orig	Sun Oct  3 12:05:54 2004
+++ Mk/bsd.php.mk	Sun Oct  3 12:54:17 2004
@@ -259,6 +259,12 @@
 		sockets sqlite sybase_ct sysvmsg sysvsem sysvshm \
 		tidy tokenizer wddx xml xmlrpc xsl xslt yaz yp zip zlib
 
+.if ${PHP_VER} == 4
+_USE_PHP_DUMMY=	openssl
+.else
+_USE_PHP_DUMMY=
+.endif
+
 bcmath_DEPENDS=	math/php${PHP_VER}-bcmath
 bz2_DEPENDS=	archivers/php${PHP_VER}-bz2
 calendar_DEPENDS=	misc/php${PHP_VER}-calendar
@@ -333,12 +339,14 @@
 
 .	for extension in ${USE_PHP}
 .		if ${_USE_PHP_ALL:M${extension}} != "" && exists(${PORTSDIR}/${${extension}_DEPENDS})
-.			if defined(USE_PHP_BUILD)
+.			if ${_USE_PHP_DUMMY:M${extension}} == ""
+.				if defined(USE_PHP_BUILD)
 BUILD_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
-.			endif
+.				endif
 RUN_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
+.			endif
 .		else
-isyes=		${extension}
+isyes=			${extension}
 .			if ${isyes:L} != "yes"
 check-makevars::
 				@${ECHO_CMD} "Unknown extension ${extension}."
diff -ur lang/php4.old/Makefile lang/php4/Makefile
--- lang/php4.old/Makefile	Sun Aug  8 21:55:19 2004
+++ lang/php4/Makefile	Sun Oct  3 13:07:57 2004
@@ -33,6 +33,15 @@
 		--with-config-file-scan-dir=${PREFIX}/etc/php \
 		--disable-all
 
+# Need to compile openssl statically
+.if !defined(WITHOUT_OPENSSL)
+CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE} \
+		--with-openssl-dir=${OPENSSLBASE}
+
+LDFLAGS+=	-lcrypto -lssl
+USE_OPENSSL=	yes
+.endif
+
 .if !defined(WITH_REGEX_TYPE) || ${WITH_REGEX_TYPE} == "php"
 CONFIGURE_ARGS+=--with-regex=php
 .else
diff -ur lang/php4.old/Makefile.ext lang/php4/Makefile.ext
--- lang/php4.old/Makefile.ext	Mon Aug 30 15:22:38 2004
+++ lang/php4/Makefile.ext	Sun Oct  3 13:04:30 2004
@@ -228,6 +228,7 @@
 .endif
 
 .if ${PHP_MODNAME} == "openssl"
+BROKEN=		"Does not work with php4"
 CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE} \
 		--with-openssl-dir=${OPENSSLBASE}
 
--- php4-openssl-static.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ale 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Oct 3 07:57:07 GMT 2004 
Responsible-Changed-Why:  
Over to maintainer(s) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72275 

From: Ryan Holmes <ryan.holmes@sbcglobal.net>
To: freebsd-gnats-submit@FreeBSD.org, odip@bionet.nsc.ru
Cc:  
Subject: Re: ports/72275: [PATCH] php4 openssl building static
Date: Wed, 10 Nov 2004 12:24:01 -0800 (PST)

 Thanks for the patch!
 
 Hey maintainer, can you please commit this or some
 other kind of fix? It would be fantastic if I could
 once again use the ports system to maintain PHP
 installs without having to manually apply patches.
 Besides this openssl issue the base/extension split is
 great, but this is a serious regression. What can I do
 to help?

From: Stijn Hoop <stijn@win.tue.nl>
To: freebsd-gnats-submit@FreeBSD.org, ale@FreeBSD.org
Cc:  
Subject: Re: ports/72275: [PATCH] php4 openssl building static
Date: Wed, 19 Jan 2005 08:32:19 +0100

 --BZaMRJmqxGScZ8Mx
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 I just ran into this exact same problem again while upgrading PHP; it
 seems to me that this PR solves the problem pretty nicely.
 
 I'm going to patch my ports now, and will let you know if it works.
 Is there any way that something like this will be committed?
 
 --Stijn
 
 --=20
 I have great faith in fools -- self confidence my friends call it.
 		-- Edgar Allan Poe
 
 --BZaMRJmqxGScZ8Mx
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (FreeBSD)
 
 iD8DBQFB7g0DY3r/tLQmfWcRAuDNAJ9EFyHyOVOs3lw/VYUOw2IKGGmQcwCfY31r
 NaQyOCXkaQcUhASVnxNL2xI=
 =1vv9
 -----END PGP SIGNATURE-----
 
 --BZaMRJmqxGScZ8Mx--

From: Stijn Hoop <stijn@win.tue.nl>
To: freebsd-gnats-submit@FreeBSD.org, ale@FreeBSD.org
Cc:  
Subject: Re: ports/72275: [PATCH] php4 openssl building static
Date: Wed, 19 Jan 2005 08:45:44 +0100

 --ExXT7PjY8AI4Hyfa
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Wed, Jan 19, 2005 at 08:32:19AM +0100, Stijn Hoop wrote:
 > I just ran into this exact same problem again while upgrading PHP; it
 > seems to me that this PR solves the problem pretty nicely.
 > 
 > I'm going to patch my ports now, and will let you know if it works.
 > Is there any way that something like this will be committed?
 
 FWIW, the patch failed to apply to my ports sources (lang/php4/Makefile
 at least), attached is a new patch. I can confirm that e.g. squirrelmail
 works with a reinstall of php4 with this patch.
 
 --Stijn
 
 -- 
 The right half of the brain controls the left half of the body.  This means
 that only left handed people are in their right mind.
 
 --ExXT7PjY8AI4Hyfa
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="newphp4.patch"
 
 Index: Mk/bsd.php.mk
 ===================================================================
 RCS file: /freebsd/cvsroot/ports/Mk/bsd.php.mk,v
 retrieving revision 1.12
 diff -u -r1.12 bsd.php.mk
 --- Mk/bsd.php.mk	17 Dec 2004 06:48:01 -0000	1.12
 +++ Mk/bsd.php.mk	19 Jan 2005 07:39:06 -0000
 @@ -259,6 +259,12 @@
  		sockets sqlite sybase_ct sysvmsg sysvsem sysvshm \
  		tidy tokenizer wddx xml xmlrpc xsl xslt yaz yp zip zlib
  
 +.if ${PHP_VER} == 4
 +_USE_PHP_DUMMY=	openssl
 +.else
 +_USE_PHP_DUMMY=
 +.endif
 +
  bcmath_DEPENDS=	math/php${PHP_VER}-bcmath
  bz2_DEPENDS=	archivers/php${PHP_VER}-bz2
  calendar_DEPENDS=	misc/php${PHP_VER}-calendar
 @@ -333,12 +339,14 @@
  
  .	for extension in ${USE_PHP}
  .		if ${_USE_PHP_ALL:M${extension}} != "" && exists(${PORTSDIR}/${${extension}_DEPENDS})
 -.			if defined(USE_PHP_BUILD)
 +.			if ${_USE_PHP_DUMMY:M${extension}} == ""
 +.				if defined(USE_PHP_BUILD)
  BUILD_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
 -.			endif
 +.				endif
  RUN_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
 +.			endif
  .		else
 -isyes=		${extension}
 +isyes=			${extension}
  .			if ${isyes:L} != "yes"
  check-makevars::
  				@${ECHO_CMD} "Unknown extension ${extension}."
 Index: lang/php4/Makefile
 ===================================================================
 RCS file: /freebsd/cvsroot/ports/lang/php4/Makefile,v
 retrieving revision 1.82
 diff -u -r1.82 Makefile
 --- lang/php4/Makefile	10 Jan 2005 17:00:34 -0000	1.82
 +++ lang/php4/Makefile	19 Jan 2005 07:36:56 -0000
 @@ -33,6 +33,15 @@
  		--with-config-file-scan-dir=${PREFIX}/etc/php \
  		--disable-all
  
 +# Need to compile openssl statically
 +.if !defined(WITHOUT_OPENSSL)
 +CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE} \
 +		--with-openssl-dir=${OPENSSLBASE}
 +
 +LDFLAGS+=	-lcrypto -lssl
 +USE_OPENSSL=	yes
 +.endif
 +
  .if !defined(WITH_REGEX_TYPE) || ${WITH_REGEX_TYPE} == "php"
  CONFIGURE_ARGS+=--with-regex=php
  .else
 Index: lang/php4/Makefile.ext
 ===================================================================
 RCS file: /freebsd/cvsroot/ports/lang/php4/Makefile.ext,v
 retrieving revision 1.8
 diff -u -r1.8 Makefile.ext
 --- lang/php4/Makefile.ext	10 Jan 2005 17:00:34 -0000	1.8
 +++ lang/php4/Makefile.ext	19 Jan 2005 07:38:15 -0000
 @@ -227,6 +227,7 @@
  .endif
  
  .if ${PHP_MODNAME} == "openssl"
 +BROKEN=		"Does not work with php4"
  CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE} \
  		--with-openssl-dir=${OPENSSLBASE}
  
 
 --ExXT7PjY8AI4Hyfa--
State-Changed-From-To: open->closed 
State-Changed-By: ale 
State-Changed-When: Mon Mar 14 14:41:56 GMT 2005 
State-Changed-Why:  
Problem fixed, thanks for submission. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72275 
>Unformatted:
