aboutsummaryrefslogtreecommitdiff
path: root/lang/php5
diff options
context:
space:
mode:
authorAlex Dupre <ale@FreeBSD.org>2014-07-07 09:23:06 +0000
committerAlex Dupre <ale@FreeBSD.org>2014-07-07 09:23:06 +0000
commitbd9297188f8379762d42804ed2bfa02433044b06 (patch)
tree9aeb8ed3d6afbecb4b7870f72e0baef3d6bfcc4a /lang/php5
parent4b9ebd7e257bda166d79db6cfc12b60628b6deaa (diff)
downloadports-bd9297188f8379762d42804ed2bfa02433044b06.tar.gz
ports-bd9297188f8379762d42804ed2bfa02433044b06.zip
Notes
Diffstat (limited to 'lang/php5')
-rw-r--r--lang/php5/Makefile8
-rw-r--r--lang/php5/distinfo4
-rw-r--r--lang/php5/files/extra-patch-php-fpm-ipv6215
-rw-r--r--lang/php5/files/patch-ext_standard_basic_functions.c20
4 files changed, 223 insertions, 24 deletions
diff --git a/lang/php5/Makefile b/lang/php5/Makefile
index 1db2c155f409..697c8e22409b 100644
--- a/lang/php5/Makefile
+++ b/lang/php5/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= php5
-PORTVERSION= 5.4.29
+PORTVERSION= 5.4.30
PORTREVISION?= 0
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP}
@@ -38,13 +38,14 @@ CONFIGURE_ARGS+=--with-layout=GNU \
USE_GNOME= libxml2
-OPTIONS_DEFINE+=CLI CGI FPM EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
+OPTIONS_DEFINE+=CLI CGI FPM FPM_IPV6 EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
OPTIONS_DEFAULT=CLI CGI FPM IPV6 LINKTHR
OPTIONS_SUB= yes
CLI_DESC= Build CLI version
CGI_DESC= Build CGI version
FPM_DESC= Build FPM version
+FPM_IPV6_DESC= Enable ipv6 patch for FPM
EMBED_DESC= Build embedded library
DEBUG_DESC= Enable debug
DTRACE_DESC= Enable DTrace support
@@ -87,6 +88,9 @@ USE_RC_SUBR+= php-fpm
CONFIGURE_ARGS+=--enable-fpm \
--with-fpm-user=${WWWOWN} \
--with-fpm-group=${WWWGRP}
+.if ${PORT_OPTIONS:MIPV6} && ${PORT_OPTIONS:MFPM_IPV6}
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-php-fpm-ipv6:-p1
+.endif
.endif
.if defined(OPTIONS_FILE_SET) && ${OPTIONS_FILE_SET:MAPACHE}
diff --git a/lang/php5/distinfo b/lang/php5/distinfo
index d1ca918d313e..ca3a145000dc 100644
--- a/lang/php5/distinfo
+++ b/lang/php5/distinfo
@@ -1,4 +1,4 @@
-SHA256 (php-5.4.29.tar.bz2) = 62ce3ca063cf04f6065eeac82117e43b44e20487bc0a0a8d05436e17a0b1e2a7
-SIZE (php-5.4.29.tar.bz2) = 12293765
+SHA256 (php-5.4.30.tar.bz2) = 32b83644e42d57388d6e5ec700c3502cde5f5e1207395b1e361e4cb2ce496ce6
+SIZE (php-5.4.30.tar.bz2) = 12315772
SHA256 (php-5.4.x-mail-header.patch) = 005ae1cd8ed17c72d7b09dee9c4466e8b16d4ecba7fe11276731ed6ff9fbb344
SIZE (php-5.4.x-mail-header.patch) = 3379
diff --git a/lang/php5/files/extra-patch-php-fpm-ipv6 b/lang/php5/files/extra-patch-php-fpm-ipv6
new file mode 100644
index 000000000000..ac00a11867f9
--- /dev/null
+++ b/lang/php5/files/extra-patch-php-fpm-ipv6
@@ -0,0 +1,215 @@
+diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
+index e056565..da14d63 100644
+--- a/sapi/fpm/fpm/fpm_sockets.c
++++ b/sapi/fpm/fpm/fpm_sockets.c
+@@ -39,29 +39,6 @@ struct listening_socket_s {
+
+ static struct fpm_array_s sockets_list;
+
+-static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockaddr_in *addr) /* {{{ */
+-{
+- struct addrinfo *res;
+- struct addrinfo hints;
+- int ret;
+-
+- memset(&hints, 0, sizeof(hints));
+- hints.ai_family = AF_INET;
+- ret = getaddrinfo(node, service, &hints, &res);
+-
+- if (ret != 0) {
+- zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
+- node, service ? ":" : "", service ? service : "",
+- gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : "");
+- return -1;
+- }
+-
+- *addr = *(struct sockaddr_in *) res->ai_addr;
+- freeaddrinfo(res);
+- return 0;
+-}
+-/* }}} */
+-
+ enum { FPM_GET_USE_SOCKET = 1, FPM_STORE_SOCKET = 2, FPM_STORE_USE_SOCKET = 3 };
+
+ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
+@@ -98,14 +75,23 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
+ }
+ /* }}} */
+
++static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */
++{
++ if (sa->sa_family == AF_INET) {
++ return &(((struct sockaddr_in*)sa)->sin_addr);
++ }
++
++ return &(((struct sockaddr_in6*)sa)->sin6_addr);
++}
++/* }}} */
++
+ static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */
+ {
+ if (key == NULL) {
+ switch (type) {
+ case FPM_AF_INET : {
+- struct sockaddr_in *sa_in = (struct sockaddr_in *) sa;
+- key = alloca(sizeof("xxx.xxx.xxx.xxx:ppppp"));
+- sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port));
++ key = alloca(INET6_ADDRSTRLEN);
++ inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key);
+ break;
+ }
+
+@@ -254,11 +240,14 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *address) /* {{{ */
+
+ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* {{{ */
+ {
+- struct sockaddr_in sa_in;
++ struct addrinfo hints, *servinfo, *p;
+ char *dup_address = strdup(wp->config->listen_address);
+- char *port_str = strchr(dup_address, ':');
++ char *port_str = strrchr(dup_address, ':');
+ char *addr = NULL;
++ int addr_len;
+ int port = 0;
++ int sock;
++ int status;
+
+ if (port_str) { /* this is host:port pair */
+ *port_str++ = '\0';
+@@ -274,23 +263,35 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
+ return -1;
+ }
+
+- memset(&sa_in, 0, sizeof(sa_in));
+-
+- if (addr) {
+- sa_in.sin_addr.s_addr = inet_addr(addr);
+- if (sa_in.sin_addr.s_addr == INADDR_NONE) { /* do resolve */
+- if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) {
+- return -1;
+- }
+- zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
++ // strip brackets from address for getaddrinfo
++ if (addr != NULL) {
++ addr_len = strlen(addr);
++ if (addr[0] == '[' && addr[addr_len - 1] == ']') {
++ addr[addr_len - 1] = '\0';
++ addr++;
+ }
+- } else {
+- sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
+ }
+- sa_in.sin_family = AF_INET;
+- sa_in.sin_port = htons(port);
++
++ memset(&hints, 0, sizeof hints);
++ hints.ai_family = AF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++
++ if ((status = getaddrinfo(addr, port_str, &hints, &servinfo)) != 0) {
++ zlog(ZLOG_ERROR, "getaddrinfo: %s\n", gai_strerror(status));
++ return -1;
++ }
++
+ free(dup_address);
+- return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
++
++ for (p = servinfo; p != NULL; p = p->ai_next) {
++ if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
++ break;
++ }
++ }
++
++ freeaddrinfo(servinfo);
++
++ return sock;
+ }
+ /* }}} */
+
+diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
+index 121c016..446c78e 100644
+--- a/sapi/fpm/fpm/fpm_sockets.h
++++ b/sapi/fpm/fpm/fpm_sockets.h
+@@ -45,10 +45,4 @@ static inline int fd_set_blocked(int fd, int blocked) /* {{{ */
+ }
+ /* }}} */
+
+-#define IPQUAD(sin_addr) \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[0], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[1], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[2], \
+- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3]
+-
+ #endif
+diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
+index ab03736..8e242aa 100644
+--- a/sapi/fpm/php-fpm.conf.in
++++ b/sapi/fpm/php-fpm.conf.in
+@@ -152,6 +152,8 @@ group = @php_fpm_group@
+ ; Valid syntaxes are:
+ ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
+ ; a specific port;
++; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
++; a specific port;
+ ; 'port' - to listen on a TCP socket to all addresses on a
+ ; specific port;
+ ; '/path/to/unix/socket' - to listen on a unix socket.
+diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt
+new file mode 100644
+index 0000000..389cb24
+--- /dev/null
++++ b/sapi/fpm/tests/003.phpt
+@@ -0,0 +1,53 @@
++--TEST--
++FPM: Test IPv6 support
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++include "include.inc";
++
++$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++
++$cfg = <<<EOT
++[global]
++error_log = $logfile
++[unconfined]
++listen = [::1]:9000
++pm = dynamic
++pm.max_children = 5
++pm.start_servers = 2
++pm.min_spare_servers = 1
++pm.max_spare_servers = 3
++EOT;
++
++$fpm = run_fpm($cfg, $tail);
++if (is_resource($fpm)) {
++ var_dump(fgets($tail));
++ var_dump(fgets($tail));
++ $i = 0;
++ while (($i++ < 30) && !($fp = fsockopen('[::1]', 9000))) {
++ usleep(10000);
++ }
++ if ($fp) {
++ echo "Done\n";
++ fclose($fp);
++ }
++ proc_terminate($fpm);
++ stream_get_contents($tail);
++ fclose($tail);
++ proc_close($fpm);
++}
++
++?>
++--EXPECTF--
++string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
++"
++string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
++"
++Done
++--CLEAN--
++<?php
++ $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++ @unlink($logfile);
++?>
diff --git a/lang/php5/files/patch-ext_standard_basic_functions.c b/lang/php5/files/patch-ext_standard_basic_functions.c
deleted file mode 100644
index 277063f8fee4..000000000000
--- a/lang/php5/files/patch-ext_standard_basic_functions.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- ext/standard/basic_functions.c.orig 2013-12-10 19:32:43.000000000 +0000
-+++ ext/standard/basic_functions.c 2013-12-13 21:55:54.052237839 +0000
-@@ -3408,7 +3408,7 @@ static void php_putenv_destructor(putenv
- SetEnvironmentVariable(pe->key, "bugbug");
- #endif
- putenv(pe->previous_value);
--# if defined(PHP_WIN32)
-+# if defined(PHP_WIN32) || __FreeBSD_version < 700050
- efree(pe->previous_value);
- # endif
- } else {
-@@ -4062,7 +4062,7 @@ PHP_FUNCTION(putenv)
- pe.previous_value = NULL;
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
--#if defined(PHP_WIN32)
-+#if defined(PHP_WIN32) || __FreeBSD_version < 700050
- /* must copy previous value because MSVCRT's putenv can free the string without notice */
- pe.previous_value = estrdup(*env);
- #else