summaryrefslogtreecommitdiff
path: root/user/php7
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2018-06-05 23:42:52 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2018-06-05 23:42:52 +0000
commit96455275ddb5a2feed979afd277419d108c836b1 (patch)
treefe5eaed7fad8d19c8a588cc375ce3b52fbb96df4 /user/php7
parent6021da9d6a1217b3d891e48a424732f3f7fcd46c (diff)
parent8be79780a4d67231c74bfe1f57648a16aea85687 (diff)
downloadpackages-96455275ddb5a2feed979afd277419d108c836b1.tar.gz
packages-96455275ddb5a2feed979afd277419d108c836b1.tar.bz2
packages-96455275ddb5a2feed979afd277419d108c836b1.tar.xz
packages-96455275ddb5a2feed979afd277419d108c836b1.zip
Merge branch 'php7' into 'master'
user/{libzip,php7}: new packages See merge request !38
Diffstat (limited to 'user/php7')
-rw-r--r--user/php7/APKBUILD514
-rw-r--r--user/php7/allow-build-recode-and-imap-together.patch20
-rw-r--r--user/php7/disabled-tests.list86
-rw-r--r--user/php7/fix-tests-devserver.patch23
-rw-r--r--user/php7/fpm-paths.patch58
-rw-r--r--user/php7/install-pear.patch15
-rw-r--r--user/php7/php-fpm.initd93
-rw-r--r--user/php7/php-fpm.logrotate13
-rw-r--r--user/php7/php-module.conf13
-rw-r--r--user/php7/pwbuflen.patch15
10 files changed, 850 insertions, 0 deletions
diff --git a/user/php7/APKBUILD b/user/php7/APKBUILD
new file mode 100644
index 000000000..4c68d7dea
--- /dev/null
+++ b/user/php7/APKBUILD
@@ -0,0 +1,514 @@
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Max Rees <maxcrees@me.com>
+
+# Bundled libraries
+#
+# Name | License | Location | State
+# ----------+---------+------------------------+---------
+# bcmath | LGPL2 | ext/bcmath/libbcmath | used
+# date | MIT | ext/date/lib | used
+# gd | BSD | ext/gd/libgd | used
+# file | BSD | ext/fileinfo/libmagic | used
+# libmbfl | LGPLv2 | ext/mbstring/libmbfl | used
+# oniguruma | BSD | ext/mbstring/oniguruma | used
+# pcre | BSD | ext/pcre/pcrelib | not used
+# sqlite3 | Public | ext/sqlite3/libsqlite | not used
+# libzip | BSD | ext/zip/lib | not used
+# libXMLRPC | BSD | ext/xmlrpc/libxmlrpc | used
+
+# Static extensions
+#
+# Name | Reason
+# ----------+--------------------------------------------
+# zlib | https://bugs.alpinelinux.org/issues/8299
+
+pkgname=php7
+_pkgname=php
+pkgver=7.2.6
+pkgrel=0
+_apiver=20170718
+pkgdesc="The PHP7 language runtime engine"
+url="http://www.php.net/"
+arch="all"
+license="PHP-3.0 BSD LGPL-2.0 MIT Zend"
+depends=""
+depends_dev="$pkgname=$pkgver-r$pkgrel autoconf pcre-dev"
+makedepends="autoconf
+ apache-httpd-dev
+ aspell-dev
+ bison
+ bzip2-dev
+ curl-dev
+ db-dev
+ enchant-dev
+ freetds-dev
+ freetype-dev
+ gdbm-dev
+ gettext-dev
+ gmp-dev
+ icu-dev
+ krb5-dev
+ libedit-dev
+ libical-dev
+ libjpeg-turbo-dev
+ libpng-dev
+ openssl-dev
+ libwebp-dev
+ libxml2-dev
+ libxpm-dev
+ libxslt-dev
+ libzip-dev
+ net-snmp-dev
+ openldap-dev
+ pcre-dev
+ postgresql-dev
+ re2c
+ sqlite-dev
+ unixodbc-dev
+ zlib-dev"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-apache $pkgname-phpdbg
+ $pkgname-embed $pkgname-litespeed $pkgname-cgi $pkgname-fpm
+ $pkgname-pear::noarch $pkgname-dbg"
+source="http://php.net/distributions/$_pkgname-$pkgver.tar.bz2
+ $_pkgname-fpm.initd
+ $_pkgname-fpm.logrotate
+ $_pkgname-module.conf
+ disabled-tests.list
+ install-pear.patch
+ fpm-paths.patch
+ allow-build-recode-and-imap-together.patch
+ fix-tests-devserver.patch
+ pwbuflen.patch"
+builddir="$srcdir/$_pkgname-$pkgver"
+_libdir="/usr/lib/$_pkgname"
+_extension_dir="$_libdir/modules"
+_extension_confd="/etc/$_pkgname/conf.d"
+
+_configure_extra_opts=""
+declare -A _extensions
+# Usage: add_ext [with|enable] name [extension dependencies...] [configure options...]
+add_ext() {
+ local ext="$1"
+ shift
+ # add_ext [with|enable] name -> --[with|enable]-name=shared
+ if [ "$ext" = "with" ] || [ "$ext" = "enable" ]; then
+ _configure_ext_opts="$_configure_ext_opts --$ext-$1=shared"
+ ext="$1"
+ shift
+ fi
+
+ case "$ext" in
+ phar) subpackages="$subpackages $pkgname-$ext:$ext";;
+ *) subpackages="$subpackages $pkgname-$ext:_extension";;
+ esac
+ _extensions[$ext]=""
+
+ local opt
+ for opt in $@; do
+ if printf '%s' "$opt" | grep -q '^-'; then
+ # Add more configure options
+ _configure_ext_opts="$_configure_ext_opts $opt"
+ else
+ # Add dependencies
+ _extensions[$ext]="${_extensions[$ext]} $opt"
+ fi
+ done
+}
+enable_ext() { add_ext enable $@; }
+with_ext() { add_ext with $@; }
+
+enable_ext 'bcmath'
+with_ext 'bz2'
+enable_ext 'calendar'
+enable_ext 'ctype'
+with_ext 'curl'
+enable_ext 'dba' \
+ --with-db4 \
+ --with-dbmaker=shared \
+ --with-gdbm
+enable_ext 'dom'
+with_ext 'enchant'
+enable_ext 'exif' mbstring
+enable_ext 'fileinfo'
+enable_ext 'ftp'
+with_ext 'gd' \
+ --with-freetype-dir=/usr \
+ --disable-gd-jis-conv \
+ --with-jpeg-dir=/usr \
+ --with-png-dir=/usr \
+ --with-webp-dir=/usr \
+ --with-xpm-dir=/usr
+with_ext 'gettext'
+with_ext 'gmp'
+with_ext 'iconv'
+# Needs makedepeneds=imap-dev
+#with_ext 'imap' \
+# --with-imap-ssl
+enable_ext 'intl'
+enable_ext 'json'
+with_ext 'ldap' \
+ --with-ldap-sasl
+enable_ext 'mbstring'
+add_ext 'mysqli' mysqlnd openssl \
+ --with-mysqli=shared,mysqlnd \
+ --with-mysql-sock=/run/mysqld/mysqld.sock
+enable_ext 'mysqlnd' openssl
+add_ext 'odbc' \
+ --with-unixODBC=shared,/usr
+enable_ext 'opcache'
+with_ext 'openssl' \
+ --with-system-ciphers \
+ --with-kerberos
+enable_ext 'pcntl'
+enable_ext 'pdo'
+add_ext 'pdo_dblib' pdo \
+ --with-pdo-dblib=shared
+add_ext 'pdo_mysql' pdo mysqlnd \
+ --with-pdo-mysql=shared,mysqlnd
+add_ext 'pdo_odbc' pdo \
+ --with-pdo-odbc=shared,unixODBC,/usr
+add_ext 'pdo_pgsql' pdo \
+ --with-pdo-pgsql=shared
+add_ext 'pdo_sqlite' pdo \
+ --with-pdo-sqlite=shared,/usr
+with_ext 'pgsql'
+enable_ext 'phar'
+enable_ext 'posix'
+with_ext 'pspell'
+# Needs makedepends=recode-dev
+#with_ext 'recode'
+enable_ext 'session'
+enable_ext 'shmop'
+enable_ext 'simplexml'
+with_ext 'snmp'
+enable_ext 'soap'
+# Needs makedepends=libsodium-dev
+#with_ext 'sodium'
+enable_ext 'sockets'
+add_ext 'sqlite3' \
+ --with-sqlite3=shared,/usr
+enable_ext 'sysvmsg'
+enable_ext 'sysvsem'
+enable_ext 'sysvshm'
+# Needs makedepends=tidyhtml-dev
+#with_ext 'tidy'
+enable_ext 'tokenizer'
+enable_ext 'wddx' xml
+enable_ext 'xml'
+enable_ext 'xmlreader' dom
+with_ext 'xmlrpc' xml
+enable_ext 'xmlwriter'
+with_ext 'xsl' dom
+enable_ext 'zip' \
+ --with-libzip=/usr
+
+# secfixes:
+# 7.2.5-r0:
+# - CVE-2018-5712
+
+prepare() {
+ cd "$builddir"
+
+ default_prepare
+ update_config_sub
+
+ local vapi=$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)
+ if [ "$vapi" != "$_apiver" ]; then
+ error "Upstreram API version is now $vapi. Expecting $_apiver"
+ error "After updating _apiver, all 3rd-party extensions must be rebuilt."
+ return 1
+ fi
+
+ # https://bugs.php.net/63362 - Not needed but installed headers.
+ # Drop some Windows specific headers to avoid installation,
+ # before build to ensure they are really not needed.
+ rm -f TSRM/tsrm_win32.h \
+ TSRM/tsrm_config.w32.h \
+ Zend/zend_config.w32.h \
+ ext/mysqlnd/config-win.h \
+ ext/standard/winver.h \
+ main/win32_internal_function_disabled.h \
+ main/win95nt.h
+
+ # Fix some bogus permissions.
+ find . -name '*.[ch]' -exec chmod 644 {} +
+
+ # XXX: Delete failing tests.
+ sed -n '/^[^#]/p' "$srcdir/disabled-tests.list" | while read item; do
+ rm $item
+ done
+
+ autoconf
+}
+
+# Notes:
+# * gd-jis-conv breaks any non-latin font rendering (vakartel).
+# * libxml cannot be build as shared.
+# * Doesn't work with system-provided onigurama, some tests fail (invalid code
+# point); probably because bundled onigurama is version 5.x, but we have 6.x.
+_build() {
+ cd "$builddir"
+
+ EXTENSION_DIR=$_extension_dir ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --libdir=$_libdir \
+ --datadir=/usr/share/$_pkgname \
+ --sysconfdir=/etc/$_pkgname \
+ --localstatedir=/var \
+ --enable-debug \
+ --with-layout=GNU \
+ --with-pic \
+ --enable-maintainer-zts \
+ --with-pear=/usr/share/$_pkgname \
+ --with-config-file-path=/etc/$_pkgname \
+ --with-config-file-scan-dir=$_extension_confd \
+ --disable-short-tags \
+ --with-icu-dir=/usr \
+ --with-libedit \
+ --without-readline \
+ --enable-libxml \
+ --with-libxml-dir=/usr \
+ --with-pcre-regex=/usr \
+ --with-zlib \
+ --with-zlib-dir=/usr \
+ $_configure_ext_opts \
+ $@
+
+ make
+}
+
+build() {
+ cd "$builddir"
+
+ # phpdbg
+ _build --enable-phpdbg \
+ --enable-phpdbg-webhelper \
+ --disable-cgi \
+ --disable-cli
+
+ # apache-httpd module
+ _build --disable-phpdbg \
+ --disable-cgi \
+ --disable-cli \
+ --with-apxs2
+ mv libs/libphp7.so sapi/apache2handler/mod_php.so
+
+ # cgi, cli, fpm, embed, litespeed
+ _build --disable-phpdbg \
+ --enable-fpm \
+ --enable-embed \
+ --with-litespeed
+}
+
+check() {
+ cd "$builddir"
+
+ # PHP is so stupid that it's not able to resolve dependencies
+ # between extensions and load them in correct order, so we must
+ # help it...
+ # opcache is Zend extension, it's handled specially in Makefile
+ local php_modules=$(_extensions_by_load_order \
+ | grep -vx opcache \
+ | xargs -n 1 printf "'$builddir/modules/%s.la' ")
+ sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \
+ s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile
+
+ NO_INTERACTION=1 REPORT_EXIT_STATUS=1 \
+ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \
+ TZ= LANG= LC_ALL= \
+ make test
+
+ echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.'
+}
+
+package() {
+ cd "$builddir"
+
+ make -j1 INSTALL_ROOT="$pkgdir" install
+
+ install -Dm644 php.ini-production "$pkgdir"/etc/$_pkgname/php.ini
+ find "$pkgdir" -name '.*' | xargs rm -rf
+ rmdir "$pkgdir"/var/run
+}
+
+dev() {
+ default_dev
+ cd "$pkgdir"
+
+ _mv usr/bin/phpize "$subpkgdir"/usr/bin/
+ _mv ./$_libdir/build "$subpkgdir"/$_libdir/
+}
+
+doc() {
+ default_doc
+ cd "$builddir"
+
+ mkdir -p "$subpkgdir/usr/share/doc/$_pkgname"
+ cp CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS \
+ README* UPGRADING* \
+ "$subpkgdir/usr/share/doc/$_pkgname/"
+}
+
+apache() {
+ pkgdesc="PHP7 Module for apache-httpd"
+ depends="$pkgname apache-httpd"
+
+ install -D -m 755 "$builddir"/sapi/apache2handler/mod_php.so \
+ "$subpkgdir"/usr/libexec/apache2/mod_php.so
+ install -D -m 644 "$srcdir"/php-module.conf \
+ "$subpkgdir"/etc/apache2/conf.d/php-module.conf
+}
+
+phpdbg() {
+ pkgdesc="Interactive PHP7 debugger"
+ #depends="$pkgname" ?
+
+ install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
+ "$subpkgdir"/usr/bin/phpdbg
+}
+
+embed() {
+ pkgdesc="PHP7 Embedded Library"
+ #depends="$pkgname" ?
+
+ _mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/
+}
+
+litespeed() {
+ pkgdesc="PHP7 LiteSpeed SAPI"
+ #depends="$pkgname" ?
+
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin
+}
+
+cgi() {
+ pkgdesc="PHP7 Common Gateway Interface"
+ depends="$pkgname"
+
+ _mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/
+}
+
+fpm() {
+ pkgdesc="PHP7 FastCGI Process Manager"
+ depends="$pkgname"
+ cd "$pkgdir"
+
+ _mv var "$subpkgdir"/
+ _mv usr/share/$_pkgname/fpm "$subpkgdir"/var/lib/$_pkgname/
+ _mv usr/sbin "$subpkgdir"/usr/
+ _mv etc/$_pkgname/php-fpm* "$subpkgdir"/etc/$_pkgname/
+
+ local file; for file in php-fpm.conf php-fpm.d/www.conf; do
+ mv "$subpkgdir"/etc/$_pkgname/$file.default \
+ "$subpkgdir"/etc/$_pkgname/$file
+ done
+
+ install -D -m 755 "$srcdir"/$_pkgname-fpm.initd \
+ "$subpkgdir"/etc/init.d/php-fpm
+
+ install -D -m 644 "$srcdir"/$_pkgname-fpm.logrotate \
+ "$subpkgdir"/etc/logrotate.d/php-fpm
+
+ mkdir -p "$subpkgdir"/var/log/$_pkgname
+}
+
+pear() {
+ pkgdesc="PHP7 Extension and Application Repository"
+ depends="$pkgname $pkgname-xml"
+ cd "$pkgdir"
+
+ # pecl needs xml extension and since we build it as shared, it must be
+ # explicitly declared to be loaded.
+ sed -i 's/\$INCARG/& -d extension=xml.so/' usr/bin/pecl
+
+ mkdir -p "$subpkgdir"/usr/bin
+ local file; for file in pecl pear peardev; do
+ mv usr/bin/$file "$subpkgdir"/usr/bin/$file
+ done
+
+ _mv etc/php/pear.conf "$subpkgdir"/etc/php/
+ _mv usr/share "$subpkgdir"/usr/
+}
+
+phar() {
+ _extension
+ cd "$pkgdir"
+
+ mkdir -p "$subpkgdir"/usr/bin
+ mv usr/bin/phar.phar "$subpkgdir"/usr/bin/phar.phar
+
+ rm usr/bin/phar
+ ln -s phar.phar "$subpkgdir"/usr/bin/phar
+}
+
+_extension() {
+ local ext="${subpkgname#$pkgname-}"
+ local extdesc="$(head -n1 "$builddir"/ext/$ext/CREDITS 2>/dev/null ||:)"
+ depends="$pkgname"
+ local dep; for dep in ${_extensions[$ext]}; do
+ depends="$depends $pkgname-$dep"
+ done
+ pkgdesc="PHP7 extension: ${extdesc:-$ext}"
+
+ local load_order=$(_extension_load_order "$ext")
+
+ # extension prefix
+ local prefix=
+ [ "$ext" = "opcache" ] && prefix="zend_"
+
+ _mv "$pkgdir"/$_extension_dir/$ext.so \
+ "$subpkgdir"/$_extension_dir/
+
+ mkdir -p "$subpkgdir"/$_extension_confd
+ echo "${prefix}extension=$ext.so" \
+ > "$subpkgdir"/$_extension_confd/$(printf %02d $load_order)_$ext.ini
+}
+
+# Prints a load order (0-based integer) for the given extension name. Extension
+# with lower load order should be loaded before exts with higher load order.
+# It's based on number of dependencies of the extension (with exception for
+# "imap"), which is flawed, but simple and good enough for now.
+_extension_load_order() {
+ local ext="$1"
+ local deps="${_extensions[$ext]}"
+
+ case "$ext" in
+ # This must be loaded after recode, even though it does
+ # not depend on it.
+ imap) echo 1;;
+ # depends=$pkgname
+ phar) echo 1;;
+ *) echo "$deps" | wc -w;;
+ esac
+}
+
+# Prints $_extensions sorted by load order and name.
+_extensions_by_load_order() {
+ local deps list ext
+
+ for ext in ${!_extensions[@]}; do
+ list="$list $(_extension_load_order $ext);$ext"
+ done
+ printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//'
+}
+
+_mv() {
+ local dest; for dest; do true; done # get last argument
+ mkdir -p "$dest"
+ mv $@
+}
+
+sha512sums="aace53b0b523484715b218e8e77ede355e73c6433e18ebd960a07c371940568d576f54455040c201b95856fa607febc19ef6539bc661a4db7984edc804c50408 php-7.2.6.tar.bz2
+23df4e779c809db3e3b8e5b0353b1aafaad2f3dc56f2d1cd45f9b0e3ad71b32e40700d6ebfe914b3c87e8e0b670d0dc862ded1e5c898adf160e33dea372e044f php-fpm.initd
+01d4ba3ef104ea378eb0e8cbb7bdee3fdf65e4bd6865eb3bc6c0dc4af31c2d52887abdf0150b5ef984b877860285a3b1af84b11ffebb5b8b722ea9faf83edfeb php-fpm.logrotate
+a7f9ba5e11652fd1cb9e756c3269269a95de083ecb5be936a85c7a09c1396db9088e0251c6a643c40235c0e776fce2a471e5c7f5a033b85c7d3b3110c2b39e48 php-module.conf
+d90595261686e7bdabc7f406c10b468df88e97742a2dff517eec94c8ff20cce7fbe5236ee8463d60cd563bdcad22c0d94d702ca5c65b738b4767abea2f6156dc disabled-tests.list
+f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 install-pear.patch
+a77dd3bdf9dc7a0f2c06ff3e7c425d062bbaa29902c17402ce98701dc99499be863ad543aa5e6a7d1c249702d6afb193398dd3199ae58e42b32b95d434fb1883 fpm-paths.patch
+f8ecae241a90cbc3e98aa4deb3d5d35ef555f51380e29f4e182a8060dffeb84be74f030a14c6b452668471030d78964f52795ca74275db05543ccad20ef1f2cc allow-build-recode-and-imap-together.patch
+f8bb322e56df79dd9f391737fb8737945cc730b14c7dc2ae8688979c565a9b97f5f2a12c9fcd0d8124624a9d09bd10228147d9e999bb94909bbe249f0a50646c fix-tests-devserver.patch
+8e538063d872f6770a57cdb844226a771ccda3d387dd1f199bb08c274b94fbe12ec0ef6df75c32071f308cb8f4ab51b91b520c7c2ed687adf96d0d322788e463 pwbuflen.patch"
diff --git a/user/php7/allow-build-recode-and-imap-together.patch b/user/php7/allow-build-recode-and-imap-together.patch
new file mode 100644
index 000000000..555092f45
--- /dev/null
+++ b/user/php7/allow-build-recode-and-imap-together.patch
@@ -0,0 +1,20 @@
+Extensions recode and imap can't be loaded together, but they can be build
+together, and that's what we want.
+
+Source: https://src.fedoraproject.org/cgit/rpms/php.git/tree/php-5.3.0-recode.patch?h=f26
+--- a/ext/recode/config9.m4
++++ b/ext/recode/config9.m4
+@@ -4,13 +4,6 @@ dnl
+
+ dnl Check for extensions with which Recode can not work
+ if test "$PHP_RECODE" != "no"; then
+- test "$PHP_IMAP" != "no" && recode_conflict="$recode_conflict imap"
+-
+- if test -n "$MYSQL_LIBNAME"; then
+- PHP_CHECK_LIBRARY($MYSQL_LIBNAME, hash_insert, [
+- recode_conflict="$recode_conflict mysql"
+- ])
+- fi
+
+ if test -n "$recode_conflict"; then
+ AC_MSG_ERROR([recode extension can not be configured together with:$recode_conflict])
diff --git a/user/php7/disabled-tests.list b/user/php7/disabled-tests.list
new file mode 100644
index 000000000..96ad3b589
--- /dev/null
+++ b/user/php7/disabled-tests.list
@@ -0,0 +1,86 @@
+# Dumb failures
+# Expects permissions on /etc to be 40755
+ext/standard/tests/file/006_error.phpt
+# session_start() missing - needs session.so
+# Test manually using the following:
+# test.ini contains "extension=./modules/session.so"
+# TEST_PHP_EXECUTABLE=sapi/cli/php sapi/cli/php run-tests.php -c test.ini $f
+Zend/tests/unset_cv05.phpt
+Zend/tests/unset_cv06.phpt
+
+# General glibc/musl incompatibility related failures
+# stdout printed in wrong order
+sapi/cgi/tests/005.phpt
+# "Filename" instead of "File name" printed for ENAMETOOLONG
+ext/standard/tests/strings/007.phpt
+# glibc will throw EINVAL for popen with mode "rw" specifically,
+# whereas musl only checks if the first character is 'r' or 'w'
+ext/standard/tests/file/popen_pclose_error.phpt
+
+# locale related failures
+# LC_NUMERIC unsupported
+ext/standard/tests/strings/sprintf_f_3.phpt
+tests/lang/034.phpt
+tests/lang/bug30638.phpt
+# LC_ALL unsupported
+ext/pcre/tests/locales.phpt
+ext/standard/tests/array/locale_sort.phpt
+ext/standard/tests/strings/setlocale_variation3.phpt
+ext/standard/tests/strings/setlocale_variation4.phpt
+ext/standard/tests/strings/setlocale_variation5.phpt
+# LC_CTYPE unsupported
+ext/standard/tests/strings/htmlentities02.phpt
+ext/standard/tests/strings/htmlentities03.phpt
+ext/standard/tests/strings/htmlentities04.phpt
+ext/standard/tests/strings/htmlentities15.phpt
+ext/standard/tests/strings/strtoupper.phpt
+# LC_MONETARY unsupported
+ext/standard/tests/strings/moneyformat.phpt
+# locale: command not found
+ext/standard/tests/strings/setlocale_basic1.phpt
+ext/standard/tests/strings/setlocale_basic2.phpt
+ext/standard/tests/strings/setlocale_basic3.phpt
+ext/standard/tests/strings/setlocale_variation1.phpt
+ext/standard/tests/strings/setlocale_variation2.phpt
+# setlocale allows "en_US.invalid"
+ext/standard/tests/strings/setlocale_error.phpt
+
+# strftime and strptime related failures
+# strftime %Z (timezone abbreviation) returns a single space
+# This appears to be a bug in php and not musl
+ext/date/tests/bug27780.phpt
+ext/date/tests/bug32555.phpt
+ext/date/tests/bug33532.phpt
+# strptime returns tm with tm_wday and tm_yday == 0
+# This appears to be a bug with *musl* and not php
+# and also strftime returns a space for %Z as before
+ext/standard/tests/time/strptime_basic.phpt
+# strptime returning NULL when %Z is used (glibc extension)
+ext/standard/tests/time/strptime_parts.phpt
+# strftime("%q") returns false instead of some string
+# This is because glibc will return "%q" and musl will return ""
+ext/date/tests/009.phpt
+
+# crypt() related failures
+# crypt() returns "*" instead of "*0" or "*1"
+ext/standard/tests/strings/bug51059.phpt
+ext/standard/tests/crypt/bcrypt_invalid_algorithm.phpt
+ext/standard/tests/crypt/bcrypt_invalid_cost.phpt
+ext/standard/tests/strings/crypt_blowfish_variation1.phpt
+ext/standard/tests/strings/crypt_blowfish_variation2.phpt
+# crypt() returning incorrect results in general, in addition to the above
+# and unexpected deprecation warning for invalid DES salt
+ext/standard/tests/strings/crypt_blowfish.phpt
+# crypt() has unexpected deprecation warning for invalid DES salt
+ext/standard/tests/strings/crypt_des_error.phpt
+# crypt() *missing* deprecation warnings for invalid DES salt
+ext/standard/tests/crypt/des_fallback_invalid_salt.phpt
+
+# "Number overflow!?"
+ext/date/tests/bug53437_var5.phpt
+ext/date/tests/bug53437_var6.phpt
+
+# These two are marked as XFAIL and do as such normally
+# But with --enable-debug, they pass...
+#sapi/fpm/tests/010.phpt
+#sapi/fpm/tests/015.phpt
diff --git a/user/php7/fix-tests-devserver.patch b/user/php7/fix-tests-devserver.patch
new file mode 100644
index 000000000..80a72f0f1
--- /dev/null
+++ b/user/php7/fix-tests-devserver.patch
@@ -0,0 +1,23 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 01 May 2017 01:33:00 +0200
+Subject: [PATCH] Fix tests failing due to extra message from built-in web server
+
+Remove messages like:
+
+ PHP 7.1.4 Development Server started at Mon May 1 00:42:39 2017
+
+from test outputs, because tests do not expect them. I have no clue what
+happens here...
+
+--- a/run-tests.php
++++ b/run-tests.php
+@@ -2005,6 +2005,9 @@
+ // Does the output match what is expected?
+ $output = preg_replace("/\r\n/", "\n", trim($out));
+
++ // Remove message from built-in development server.
++ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output);
++
+ /* when using CGI, strip the headers from the output */
+ $headers = array();
+
diff --git a/user/php7/fpm-paths.patch b/user/php7/fpm-paths.patch
new file mode 100644
index 000000000..56d40298b
--- /dev/null
+++ b/user/php7/fpm-paths.patch
@@ -0,0 +1,58 @@
+--- a/sapi/fpm/fpm/fpm_conf.c
++++ b/sapi/fpm/fpm/fpm_conf.c
+@@ -1205,7 +1205,7 @@
+ }
+
+ if (!fpm_global_config.error_log) {
+- fpm_global_config.error_log = strdup("log/php-fpm.log");
++ fpm_global_config.error_log = strdup("log/php/error.log");
+ }
+
+ #ifdef HAVE_SYSTEMD
+@@ -1710,7 +1710,7 @@
+ if (fpm_globals.prefix == NULL) {
+ spprintf(&tmp, 0, "%s/php-fpm.conf", PHP_SYSCONFDIR);
+ } else {
+- spprintf(&tmp, 0, "%s/etc/php-fpm.conf", fpm_globals.prefix);
++ spprintf(&tmp, 0, "%s/etc/php/php-fpm.conf", fpm_globals.prefix);
+ }
+
+ if (!tmp) {
+
+--- a/sapi/fpm/php-fpm.conf.in
++++ b/sapi/fpm/php-fpm.conf.in
+@@ -22,4 +22,4 @@
+ ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
+-; Default Value: log/php-fpm.log
+-;error_log = log/php-fpm.log
++; Default Value: log/php/error.log
++;error_log = log/php/error.log
+
+--- a/sapi/fpm/www.conf.in
++++ b/sapi/fpm/www.conf.in
+@@ -256,7 +256,7 @@
+
+ ; The access log file
+ ; Default: not set
+-;access.log = log/$pool.access.log
++;access.log = log/php/$pool.access.log
+
+ ; The access log format.
+ ; The following syntax is allowed
+@@ -320,7 +320,7 @@
+ ; The log file for slow requests
+ ; Default Value: not set
+ ; Note: slowlog is mandatory if request_slowlog_timeout is set
+-;slowlog = log/$pool.log.slow
++;slowlog = log/php/$pool.slow.log
+
+ ; The timeout for serving a single request after which a PHP backtrace will be
+ ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+@@ -418,6 +418,6 @@
+ ; specified at startup with the -d argument
+ ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+ ;php_flag[display_errors] = off
+-;php_admin_value[error_log] = /var/log/fpm-php.www.log
++;php_admin_value[error_log] = /var/log/php/$pool.error.log
+ ;php_admin_flag[log_errors] = on
+ ;php_admin_value[memory_limit] = 32M
diff --git a/user/php7/install-pear.patch b/user/php7/install-pear.patch
new file mode 100644
index 000000000..18747be94
--- /dev/null
+++ b/user/php7/install-pear.patch
@@ -0,0 +1,15 @@
+--- ./pear/Makefile.frag.orig 2013-04-12 07:02:27.041602514 +0000
++++ ./pear/Makefile.frag 2013-04-12 07:04:09.065836822 +0000
+@@ -2,8 +2,11 @@
+
+ peardir=$(PEAR_INSTALLDIR)
+
++# help the built php to find xml extension so we can install pear
++PEAR_INSTALL_XML_FLAGS = -d extension_dir="$(top_builddir)/modules" -d extension=xml.so
++
+ # Skip all php.ini files altogether
+-PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 -ddetect_unicode=0
++PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 -ddetect_unicode=0 $(PEAR_INSTALL_XML_FLAGS)
+
+ WGET = `which wget 2>/dev/null`
+ FETCH = `which fetch 2>/dev/null`
diff --git a/user/php7/php-fpm.initd b/user/php7/php-fpm.initd
new file mode 100644
index 000000000..46c65ec2e
--- /dev/null
+++ b/user/php7/php-fpm.initd
@@ -0,0 +1,93 @@
+#!/sbin/openrc-run
+
+# If you want to run separate master process per pool, then create a symlink
+# to this runscript for each pool. In that mode, the php-fpm daemon is started
+# as nobody by default. You can override the user (and group) by declaring
+# variable "user" and optionally "group" in conf.d file, or in the $fpm_config
+# file (the former has precedence).
+
+: ${name:="PHP FastCGI Process Manager"}
+
+command="/usr/sbin/php-fpm"
+command_background="yes"
+start_stop_daemon_args="--quiet"
+pidfile="/run/$RC_SVCNAME/php-fpm.pid"
+retry="SIGTERM/20"
+
+# configtest is here only for backward compatibility
+extra_commands="checkconfig configtest"
+extra_started_commands="reload reopen"
+description_checkconfig="Run php-fpm config check"
+description_reload="Gracefully reload workers and config"
+description_reopen="Reopen log files"
+
+required_files="$fpm_config"
+
+depend() {
+ need net
+ use apache2 lighttpd nginx
+}
+
+init_vars() {
+ # Defaults for single master process with multiple pools
+ if [ "$RC_SVCNAME" = "php-fpm" ]; then
+ : ${fpm_config:="/etc/php/php-fpm.conf"}
+ : ${user:="root"}
+ # Defaults for master process per pool
+ else
+ : ${fpm_config="/etc/php/php-fpm.d/${RC_SVCNAME#php-fpm.}.conf"}
+ : ${user:="$(conf_get user)"}
+ : ${user:="nobody"}
+ : ${group:="$(conf_get group)"}
+ fi
+ command_args="--nodaemonize --fpm-config $fpm_config"
+ start_stop_daemon_args="$start_stop_daemon_args
+ --user $user ${group:+"--group $group"}"
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ # If unix socket is used (instead of TCP/IP), then ensure that the
+ # directory exists and has correct privileges.
+ local listen="$(conf_get listen)"
+ if [ "${listen:0:1}" = "/" ]; then
+ checkpath -d -o $user:$group "$(dirname "$listen")"
+ fi
+
+ checkpath -d "$(dirname "$pidfile")"
+}
+
+reload() {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal USR2 --pidfile "$pidfile"
+ eend $?
+}
+
+reopen() {
+ ebegin "Reopening $name log files"
+ start-stop-daemon --signal USR1 --pidfile "$pidfile"
+ eend $?
+}
+
+checkconfig() {
+ init_vars
+ ebegin "Checking $fpm_config"
+
+ local out
+ out="$(su -s /bin/sh -c "$command --test --fpm-config $fpm_config" $user 2>&1)" || {
+ printf "%s\n" "$out"
+ eend 1 "failed, please correct errors above"
+ return 1
+ }
+}
+
+configtest() {
+ ewarn "configtest is deprecated, use checkconfig instead"
+ checkconfig
+}
+
+conf_get() {
+ local key="$1"
+ sed -nE "s/^${key}\s*=\s*\"?([^\";]+).*/\1/p" "$fpm_config" | head -n 1
+}
diff --git a/user/php7/php-fpm.logrotate b/user/php7/php-fpm.logrotate
new file mode 100644
index 000000000..ca87ba981
--- /dev/null
+++ b/user/php7/php-fpm.logrotate
@@ -0,0 +1,13 @@
+/var/log/php/*.log {
+ rotate 7
+ daily
+ missingok
+ notifempty
+ delaycompress
+ compress
+ dateext
+ sharedscripts
+ postrotate
+ /etc/init.d/php-fpm --ifstarted --quiet reopen
+ endscript
+}
diff --git a/user/php7/php-module.conf b/user/php7/php-module.conf
new file mode 100644
index 000000000..f29fc3125
--- /dev/null
+++ b/user/php7/php-module.conf
@@ -0,0 +1,13 @@
+LoadModule php7_module /usr/libexec/apache2/mod_php.so
+
+DirectoryIndex index.php index.html
+
+<FilesMatch \.php$>
+ SetHandler application/x-httpd-php
+</FilesMatch>
+
+# Uncomment the following to allow .phps files to be handled by the php source filter,
+# and displayed as syntax-highlighted source code
+#<FilesMatch "\.phps$">
+# SetHandler application/x-httpd-php-source
+#</FilesMatch>
diff --git a/user/php7/pwbuflen.patch b/user/php7/pwbuflen.patch
new file mode 100644
index 000000000..7d2685b55
--- /dev/null
+++ b/user/php7/pwbuflen.patch
@@ -0,0 +1,15 @@
+sysconf(_SC_GETPW_R_SIZE_MAX) returns -1 on musl and 1024 on glibc.
+
+--- php-7.2.6/main/main.c 2018-06-04 23:30:18.790089810 -0400
++++ php-7.2.6/main/main.c 2018-06-04 23:30:14.660089806 -0400
+@@ -1315,7 +1315,9 @@
+ int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ char *pwbuf;
+
+- if (pwbuflen < 1) {
++ if (pwbuflen == -1) {
++ pwbuflen = 1024;
++ } else if (pwbuflen < 1) {
+ return "";
+ }
+ pwbuf = emalloc(pwbuflen);