Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2005 10:06:01 +0300
From:      Vasil Dimov <vd@datamax.bg>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        ale@FreeBSD.org
Subject:   ports/81699: www/pserv's PHP support only works with php-cgi SAPI
Message-ID:  <20050531070601.GA38896@sinanica.bg.datamax>
Resent-Message-ID: <200505310710.j4V7A138079069@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         81699
>Category:       ports
>Synopsis:       www/pserv's PHP support only works with php-cgi SAPI
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 31 07:10:01 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050531070601.GA38896>