From vd@datamax.bg  Tue May 31 07:06:03 2005
Return-Path: <vd@datamax.bg>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E681716A41C;
	Tue, 31 May 2005 07:06:02 +0000 (GMT)
	(envelope-from vd@datamax.bg)
Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5C88C43D54;
	Tue, 31 May 2005 07:06:02 +0000 (GMT)
	(envelope-from vd@datamax.bg)
Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1])
	by jengal.datamax.bg (Postfix) with QMQP
	id 2CB8B87CD; Tue, 31 May 2005 10:06:01 +0300 (EEST)
Received: (nullmailer pid 39001 invoked by uid 1004);
	Tue, 31 May 2005 07:06:01 -0000
Message-Id: <20050531070601.GA38896@sinanica.bg.datamax>
Date: Tue, 31 May 2005 10:06:01 +0300
From: Vasil Dimov <vd@datamax.bg>
Reply-To: vd@datamax.bg
To: FreeBSD-gnats-submit@freebsd.org
Cc: ale@freebsd.org
Subject: www/pserv's PHP support only works with php-cgi SAPI
X-Send-Pr-Version: 3.113

>Number:         81699
>Category:       ports
>Synopsis:       www/pserv's PHP support only works with php-cgi SAPI
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 31 07:10:01 GMT 2005
>Closed-Date:    Mon Jul 02 12:50:00 GMT 2007
>Last-Modified:  Mon Jul  2 12:50:04 GMT 2007
>Originator:     Vasil Dimov
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
DataMax
>Environment:

System: FreeBSD sinanica.bg.datamax 5.4-STABLE FreeBSD 5.4-STABLE #6: Tue May 10 12:46:25 EEST 2005     root@sinanica.bg.datamax:/usr/obj/usr/src/sys/SINANICA-SMP  i386

>Description:

www/pserv genereates bogus headers in the http-response if PHP with CLI
SAPI is installed.

In the included patch OPTIONS= was removed, because it is not possible
to use it for the following reasons:

1. WITH_PHP must be tested AFTER including bsd.port.pre.mk
2. USE_PHP and WANT_PHP_CGI must be set BEFORE including bsd.port.pre.mk
3. USE_PHP and WANT_PHP_CGI must be set with ".if defined(WITH_PHP)" test

You see - 3. conflicts with 1. & 2.
The solution is to remove 1. condition and propmt the user to set
WITH_PHP BEFORE we include bsd.port.pre.mk (as done in many ports).

>How-To-Repeat:

% php -v
PHP 4.3.11 (cli) (built: May 31 2005 09:34:26)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

% echo -ne "GET /tmp/test.php HTTP/1.1\r\n\r\n" |socket localhost 8080
HTTP/1.0 200 OK
Connection: close
Date: Tue, 31 May 2005 09:38:30 EEST
Server: pServ/3.3
phpinfo()
PHP Version => 4.3.11

System => FreeBSD sinanica.bg.datamax 5.4-STABLE FreeBSD 5.4-STABLE #6: Tue May 10 12:46:25 EEST 2005     root@sinanica.bg.datamax:/usr/obj/usr/src/sys/SINANICA-SMP i386
...


You see, this is totally incorrect. It should be:


% echo -ne "GET /tmp/test.php HTTP/1.1\r\n\r\n" |socket localhost 8080
HTTP/1.0 200 OK
Connection: close
Date: Tue, 31 May 2005 09:41:07 EEST
Server: pServ/3.3
Content-type: text/html
X-Powered-By: PHP/4.3.11

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html><head>
...

% php -v
PHP 4.3.11 (cgi) (built: May 31 2005 09:18:03)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

>Fix:

--- pserv_php.diff begins here ---
diff -urN pserv.orig/Makefile pserv/Makefile
--- pserv.orig/Makefile	Mon May 30 19:36:17 2005
+++ pserv/Makefile	Tue May 31 09:44:14 2005
@@ -7,6 +7,7 @@
 
 PORTNAME=	pserv
 PORTVERSION=	3.3
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -17,11 +18,19 @@
 USE_REINPLACE=	yes
 GNU_CONFIGURE=	yes
 
-OPTIONS=	LOG "Enable logging" on \
-		PHP "Enable PHP support" on
+.if defined(WITH_PHP)
+USE_PHP=yes
+WANT_PHP_CGI=yes
+.endif
 
 .include <bsd.port.pre.mk>
 
+pre-everything::
+	@${ECHO_MSG} "You can change Pserv's default capabilities by defining:"
+	@${ECHO_MSG} "  WITHOUT_LOG=yes         Disable logging"
+	@${ECHO_MSG} "  WITH_PHP=yes            Enable PHP support"
+	@${ECHO_MSG} ""
+
 post-patch:
 	@${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g;s|%%LOCALBASE%%|${LOCALBASE}|g" \
 		${WRKSRC}/defaults/pserv.conf ${WRKSRC}/sources/main.h
@@ -29,7 +38,7 @@
 	@${REINPLACE_CMD} "s|define LOG|undef LOG|" \
 		${WRKSRC}/sources/main.h
 .endif
-.if defined(WITHOUT_PHP)
+.if !defined(WITH_PHP)
 	@${REINPLACE_CMD} "s|define PHP|undef PHP|" \
 		${WRKSRC}/sources/main.h
 .endif
--- pserv_php.diff ends here ---
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ale 
Responsible-Changed-By: flz 
Responsible-Changed-When: Tue May 31 08:36:15 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81699 
State-Changed-From-To: open->closed 
State-Changed-By: ale 
State-Changed-When: Mon Jul 2 12:49:38 UTC 2007 
State-Changed-Why:  
Fixed. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/81699: commit references a PR
Date: Mon,  2 Jul 2007 12:49:27 +0000 (UTC)

 ale         2007-07-02 12:49:20 UTC
 
   FreeBSD ports repository
 
   Modified files:
     www/pserv            Makefile 
   Log:
   Add php-cgi dependency.
   
   PR:             ports/81699
   Submitted by:   vd
   
   Revision  Changes    Path
   1.13      +5 -0      ports/www/pserv/Makefile
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
