Subject: [alpine-aports] [PATCH] community/php7: upgrade to 7.1.0, close issues #5367, #5670

From: Valery Kartel <[email-masked]>
Date: Fri, 2 Dec 2016 18:53:51 +0200

--
This commit covers my previous patch http://patchwork.alpinelinux.org/patch/2576

WARN: PHP API version changed. All external extensions needs to be rebuilded!

added shared extension 'recode'
fixed imap loading order (http://php.net/manual/en/recode.installation.php)
removed shared extension 'readline', made it compiled-in (Bug #5670)
removed prefix in common binaries: php, php-config, phpize (Support #5367)
some fixes in APKBUILD and others
---
 community/php7/APKBUILD           | 219 ++++++++++++++++----------------------
 community/php7/php7-fpm.initd     |  35 +++---
 community/php7/php7-fpm.logrotate |   2 +-
 community/php7/php7-module.conf   |   2 +-
 community/php7/pid_log.patch      |  24 +++--
 community/php7/tidy-buffio.patch  |  11 --
 6 files changed, 124 insertions(+), 169 deletions(-)
 delete mode 100644 community/php7/tidy-buffio.patch

diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD
index c0b1f5cdc3..bb8d9e930a 100644
--- a/community/php7/APKBUILD
+++ b/community/php7/APKBUILD
@@ -2,35 +2,40 @@
 # Maintainer: Valery Kartel <[email-masked]>
 pkgname=php7
 _pkgreal=php
-pkgver=7.0.13
-pkgrel=1
+pkgver=7.1.0
+pkgrel=0
 pkgdesc="The PHP language runtime engine - 7th branch"
 url="http://www.php.net/"
 arch="all"
 license="PHP-3"
 options=""
 depends="$pkgname-common"
-depends_dom="$pkgname-xml"
-depends_mysqlnd="$pkgname-mysqli"
-depends_phar="$pkgname"
-depends_soap="$pkgname-xml"
-depends_wddx="$pkgname-xml"
-depends_xmlreader="$pkgname-dom"
-depends_xmlrpc="$pkgname-xml"
-depends_xsl="$pkgname-dom"
+# make imap loaded after recode
+depends_imap="-- $depends_recode"
+depends_mysqlnd="$pkgname-mysqli $depends_mysqli"
+depends_pdo_mysql="$pkgname-pdo $depends_pdo"
+depends_pdo_odbc="$pkgname-pdo $depends_pdo"
+depends_pdo_pgsql="$pkgname-pdo $depends_pdo"
+depends_pdo_sqlite="$pkgname-pdo $depends_pdo"
+depends_dom="$pkgname-xml $depends_xml"
+depends_soap="$pkgname-xml $depends_xml"
+depends_wddx="$pkgname-xml $depends_xml"
+depends_xmlrpc="$pkgname-xml $depends_xml"
+depends_xmlreader="$pkgname-dom $depends_dom"
+depends_xsl="$pkgname-dom $depends_dom"
+_prefix_opcache="zend_"
 makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev
 	aspell-dev enchant-dev expat-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev
 	libical-dev libressl-dev openldap-dev net-snmp-dev db-dev krb5-dev gdbm-dev sqlite-dev
 	freetds-dev mariadb-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libxpm-dev
 	libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev gsoap-dev recode-dev
-	readline-dev paxmark gettext-dev
+	readline-dev gettext-dev
 	"
 source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
 	$pkgname-fpm.initd
 	$pkgname-fpm.logrotate
 	$pkgname-module.conf
 	install-pear.patch
-	tidy-buffio.patch
 	includedir.patch
 	pid_log.patch
 	"
@@ -38,8 +43,8 @@ builddir="$srcdir/$_pkgreal-$pkgver"
 
 _exts="bcmath bz2 calendar ctype curl dba dom enchant exif ftp gd gettext gmp iconv imap intl json
 	ldap mbstring mcrypt mysqli mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
-	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar:phar posix pspell readline session shmop snmp soap
-	sockets sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xsl zip zlib
+	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar:phar posix pspell recode session shmop snmp
+	soap sockets sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xsl zip zlib
 	"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname-embed
 	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch
@@ -52,14 +57,12 @@ for _ext in $_exts; do
 done
 subpackages="$subpackages $pkgname-common::noarch"
 
-_apiver="20151012"
+_apiver="20160303"
 
 prepare() {
 	cd "$builddir"
-
 	default_prepare || return 1
 	update_config_sub || return 1
-
 	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"
@@ -74,7 +77,6 @@ _build() {
 		--build=$CBUILD \
 		--host=$CHOST \
 		--prefix=/usr \
-		--program-suffix=7 \
 		--libdir=/usr/lib/$pkgname \
 		--datadir=/usr/share/$pkgname \
 		--sysconfdir=/etc/$pkgname \
@@ -138,226 +140,189 @@ _build() {
 		--with-xsl=shared \
 		--enable-wddx=shared \
 		--enable-zip=shared --with-libzip=shared \
+		--with-readline \
 		$@ || return 1
-	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183 (from main/php)
+	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183 (from main/php5)
 	make || return 1
 }
 
 build() {
 	cd "$builddir"
-
 	# phpdbg
 	_build --enable-phpdbg \
 		--enable-phpdbg \
 		--enable-phpdbg-webhelper \
 		--disable-cgi \
 		--disable-cli \
-		--with-readline \
 		|| return 1
 	# apache2 module
 	_build --disable-phpdbg \
 		--disable-cgi \
 		--disable-cli \
 		--with-apxs2 \
-		--with-readline=shared \
 		|| return 1
-	mv libs/libphp7.so sapi/apache2handler/mod_php7.so
+	mv libs/lib$pkgname.so sapi/apache2handler
+	# cgi,cli,fpm,embed,litespeed - with recode, without imap
+	_build --disable-phpdbg \
+		--enable-fpm \
+		--enable-embed \
+		--with-litespeed \
+		--without-imap --without-imap-ssl \
+		--with-recode=shared \
+		|| return 1
 	# cgi,cli,fpm,embed,litespeed
 	_build --disable-phpdbg \
 		--enable-fpm \
 		--enable-embed \
 		--with-litespeed \
-		--with-readline=shared \
 		|| return 1
 }
 
 package() {
 	cd "$builddir"
-
 	make -j1 INSTALL_ROOT="$pkgdir" install || return 1
-
-	install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini || return 1
-
-	local file; for file in pear peardev pecl; do
-		sed -i -e "s~/usr/bin/php~/usr/bin/php7~g" \
-			-e "s~PHP=php~PHP=php7~" \
-			"$pkgdir"/usr/bin/$file || return 1
-	done
-	paxmark -m "$pkgdir"/usr/bin/php7
-
-	find "$pkgdir" -name '.*' | xargs rm -rf || return 1
-	rmdir "$pkgdir"/var/run
+	rm -fr "$pkgdir"/.[[:alpha:]]* "$pkgdir"/var || return 1
+	mv "$pkgdir"/usr/share/man/man1/php-cgi.1 \
+		"$pkgdir"/usr/share/man/man1/$pkgname-cgi.1
+	mv "$pkgdir"/usr/share/man/man8/php-fpm.8 \
+		"$pkgdir"/usr/share/man/man8/$pkgname-fpm.8
 }
 
 dev() {
 	default_dev
-	depends="$depends $pkgname $pkgname-pear"
-
-	mkdir -p "$subpkgdir"/usr/bin \
-		"$subpkgdir"/usr/lib/$pkgname
-
-	mv "$pkgdir"/usr/bin/php-config7 "$pkgdir"/usr/bin/peardev \
-		"$subpkgdir"/usr/bin/ || return 1
-	mv "$pkgdir"/usr/lib/$pkgname/build \
-		"$subpkgdir"/usr/lib/$pkgname/
+	depends="$depends $pkgname-pear"
+	mv "$pkgdir"/usr/bin/phpize "$pkgdir"/usr/bin/peardev \
+		"$subpkgdir"/usr/bin/
+	mv "$pkgdir"/usr/lib/$pkgname/build "$subpkgdir"/usr/lib/$pkgname/
 }
 
 doc() {
 	default_doc
-
-	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
-
-	local file
 	for file in CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README* UPGRADING*; do
-		cp "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
+		install -Dm644 "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/$file || return 1
 	done
 }
 
 apache2() {
 	pkgdesc="PHP Module for Apache2"
 	depends="$pkgname-common apache2"
-
-	install -D -m755 "$builddir"/sapi/apache2handler/mod_php7.so \
-		"$subpkgdir"/usr/lib/apache2/mod_php7.so || return 1
-
-	install -D -m644 "$srcdir"/php7-module.conf \
-		"$subpkgdir"/etc/apache2/conf.d/php7-module.conf
+	install -Dm755 "$builddir"/sapi/apache2handler/lib$pkgname.so \
+		"$subpkgdir"/usr/lib/apache2/lib$pkgname.so || return 1
+	install -Dm644 "$srcdir"/$pkgname-module.conf \
+		"$subpkgdir"/etc/apache2/conf.d/$pkgname-module.conf
 }
 
 phpdbg() {
 	pkgdesc="Interactive PHP debugger"
 	depends="$pkgname-common"
-
 	install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
-		 "$subpkgdir"/usr/bin/phpdbg7
+		"$subpkgdir"/usr/bin/phpdbg
 }
 
 embed() {
 	pkgdesc="PHP Embedded Library"
 	depends="$pkgname-common"
-
 	mkdir -p "$subpkgdir"/usr/lib
-	mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/
+	mv "$pkgdir"/usr/lib/lib$pkgname.so "$subpkgdir"/usr/lib/
 }
 
 litespeed() {
 	pkgdesc="PHP LiteSpeed SAPI"
 	depends="$pkgname-common"
-
 	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp7
+	mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/
 }
 
 cgi() {
 	pkgdesc="PHP Common Gateway Interface"
 	depends="$pkgname-common"
-
 	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/php-cgi7 "$subpkgdir"/usr/bin/
+	mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/$pkgname-cgi
 }
 
 fpm() {
 	pkgdesc="PHP FastCGI Process Manager"
 	depends="$pkgname-common"
-
-	mv "$pkgdir"/var "$subpkgdir"/ || return 1
-
 	mkdir -p "$subpkgdir"/etc/$pkgname \
 		"$subpkgdir"/usr \
 		"$subpkgdir"/var/lib \
 		"$subpkgdir"/var/log/$pkgname
-
-	mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname/ || return 1
-	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ || return 1
+	mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
+	mv "$subpkgdir"/usr/sbin/php-fpm "$subpkgdir"/usr/sbin/$pkgname-fpm || return 1
 	mv "$pkgdir"/etc/$pkgname/php-fpm* "$subpkgdir"/etc/$pkgname/ || return 1
-
-	local file; for file in php-fpm.conf php-fpm.d/www.conf; do
-		mv "$subpkgdir"/etc/$pkgname/$file.default \
-			"$subpkgdir"/etc/$pkgname/$file || return 1
-	done
-
-	install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/php-fpm7 || return 1
-	install -D -m644 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/php-fpm7
+	find "$subpkgdir"/etc/$pkgname -name *.default \
+		-exec sh -c 'f={}; mv $f ${f%.default}' \;
+	install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/$pkgname-fpm
+	install -D -m644 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/$pkgname-fpm
 }
 
 pear() {
 	pkgdesc="PHP Extension and Application Repository"
 	depends="$pkgname $pkgname-xml"
-
 	mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/etc/$pkgname
-
-	local file; for file in phpize7 pecl pear; do
-		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/
-	done
+	mv "$pkgdir"/usr/bin/pecl "$pkgdir"/usr/bin/pear \
+		"$subpkgdir"/usr/bin/
 	mv "$pkgdir"/etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ || return 1
 	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
 }
 
 common() {
 	pkgdesc="$pkgdesc (common config)"
-
-	mkdir -p "$subpkgdir"/usr
-	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
-	mv "$pkgdir"/etc "$subpkgdir"/ || return 1
-
-	mkdir "$subpkgdir"/etc/$pkgname/conf.d
+	install -Dm644 "$builddir"/php.ini-production \
+		"$subpkgdir"/etc/$pkgname/php.ini || return 1
+	# exit with an error if there is any configs
+	# or if some modules were not in subpackages
+	rmdir "$pkgdir"/usr/lib/$pkgname/modules \
+		"$pkgdir"/etc/$pkgname || return 1
+	rm -fr "$pkgdir"/etc "$pkgdir"/usr/lib
 }
 
 phar() {
+	depends="$pkgname"
 	_package_ext || return 1
 	mkdir -p "$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
 }
 
 _package_ext() {
-	local extname="${subpkgname#$pkgname-}"
-	local extdepends="$(eval "echo \$depends_$extname")"
+	local dep=
+	local sep=
+	local elo=0
+	local extname=${subpkgname#$pkgname-}
 	pkgdesc="PHP7 extension: $extname"
-	depends="$depends $extdepends"
-
-	case "$extname" in
-	pdo_*) depends="$depends $pkgname-pdo"
-	esac
-
-	# extension dependencies and loading order
-	local elo=00
-	[ -z "$extdepends" ] || elo=01
-
-	# extension prefix
-	local prefix=
-	[ "$extname" != "opcache" ] || prefix="zend_"
-
+	for dep in $(eval echo \$depends_$extname); do
+		elo=$(expr $elo + 1)
+		[ "$dep" = "--" ] && sep=$dep
+		[ "$sep" = "--" ] || depends="$depends $dep"
+	done
 	mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
 		"$subpkgdir"/etc/$pkgname/conf.d
 	mv "$pkgdir"/usr/lib/$pkgname/modules/$extname.so \
 		"$subpkgdir"/usr/lib/$pkgname/modules/ || return 1
-
-	echo "${prefix}extension=$extname.so" \
-		> "$subpkgdir"/etc/$pkgname/conf.d/${elo}_${extname}.ini
+	echo $(eval echo \$_prefix_$extname)extension=$extname.so >\
+		"$subpkgdir"/etc/$pkgname/conf.d/$(printf %02d $elo)_${extname}.ini
 }
 
-md5sums="f62d1c9ddb3a791b7eac423c7b2a769c  php-7.0.13.tar.bz2
-4115cbd0843c72adc3bd42fecd6d4540  php7-fpm.initd
-25bde13e7894c2930d97fad68d5dd3b3  php7-fpm.logrotate
-47be6cd1ed92f21579e15bf2003a709f  php7-module.conf
+md5sums="54e364b60a88db77adb96aacb10f10a4  php-7.1.0.tar.bz2
+d3663c0871e62c3adf4a895909bdc885  php7-fpm.initd
+6085eb7854c192b6a533bb18eeaebe2f  php7-fpm.logrotate
+3cea5c5334508dfc43591cd5bb1483c6  php7-module.conf
 483bc0a85c50a9a9aedbe14a19ed4526  install-pear.patch
-66f0037a029f9eed2b31d2e1d50f1860  tidy-buffio.patch
 d872e633c9b33c3c9f629dd2edd2e5c5  includedir.patch
-6ba762ab7a105163b8e5b3913deae109  pid_log.patch"
-sha256sums="d090bb523812117ec0c08d8f0b5c5f0616aa7a29a2eeee0374efe53a7cfe88c1  php-7.0.13.tar.bz2
-a7e4fc0eeba18aec019f62ed966915afd82b6b5fb1e1af93b59f964b5bd66172  php7-fpm.initd
-6e4406f21b69085714cdb9d9a67c08e27a1c737ab353f9813cb2fc268352d2c6  php7-fpm.logrotate
-276c823ee666ea73b36d4e97174eeea05713125b61f7f8681e350453c4123143  php7-module.conf
+edb29ea13fab52e50d3ee305e3f38060  pid_log.patch"
+sha256sums="68bcfd7deed5b3474d81dec9f74d122058327e2bed0ac25bbc9ec70995228e61  php-7.1.0.tar.bz2
+c57d381630bb90d8a12b4b0c742312493ca4bf1e164ae305a9c920df25f45100  php7-fpm.initd
+bcd2f0a5caed573e4ac31a0dea6a7cd2584cdb9943f8a390b80ed900180dbb2a  php7-fpm.logrotate
+dc73bb3a3bca94cdf070338ecfed85940548eda978e9392a711226ba62c1ce60  php7-module.conf
 f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab  install-pear.patch
-5dc8f32e5e2b1cd6317ada5a5adb9b5f0802ed6e0dbe065d7bfcc0f55d47e0d5  tidy-buffio.patch
 ea74966a23b1b54548ee35e9ccc2fc8d2b7c2285c385c44d6b23d9e2f25ea1a7  includedir.patch
-0cca8729c64682387a8c44ed74f0966da697f2817152d8d05bb25bedc7eaafec  pid_log.patch"
-sha512sums="53276fbd35855b9337120fd74f6932e70822b8e5508b6bed068a78805049d36960300e781ec5640f4a90f2d4a09e506084a865341d151bc5c87b7777cb5ff6a3  php-7.0.13.tar.bz2
-1c708de82d1086f272f484faf6cf6d087af7c31750cc2550b0b94ed723961b363f28a947b015b2dfc0765caea185a75f5d2c2f2b099c948b65c290924f606e4f  php7-fpm.initd
-cacce7bf789467ff40647b7319e3760c6c587218720538516e8d400baa75651f72165c4e28056cd0c1dc89efecb4d00d0d7823bed80b29136262c825ce816691  php7-fpm.logrotate
-fbf9a1572d37370ec0d126502e1d066e045a992484d8fc4f1e2ede330134c1a15f4029f29fa4daebd48eed78b045dc051ced69fbf1f11efc7ad81d884a639a99  php7-module.conf
+60ced777af95bd0110c71a3d00a3169fd4b1e599560028e799c45599cc14c2a6  pid_log.patch"
+sha512sums="94c051abd19dbdf3d016f068269b5c6d667938def4df1732f7826a0ab2dd1fa541ff838dafc1531e1c4fa790df0b07feaef97512b28dda3e4ce5e724ede89b37  php-7.1.0.tar.bz2
+a9bb2a39deab4804627cae72be0bc18e7e189998aa555cee4cd5da7470ff7018cf53bfb4318daaba6709d1e000002bfefaf4e841a94eac132edef5dc20f1845b  php7-fpm.initd
+da404e9d7bb7af484351b6c9d2a2e8f1eff8d44704da3d877bc6af11c638e0a1f7225ea5ac381cada316876dfaaa81254c87fe3867849fb898478f459fdc367b  php7-fpm.logrotate
+ebfa4365c88c745fb27d9271d66daabeaecb26ce31e01716d42c187a0afd06e22e815a66e2aafb29e1e88a23248e3b4182928033294928985c9b8362174738c8  php7-module.conf
 f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505  install-pear.patch
-6894c9cba7752a3406e774d9efc0e058c37433493c1c20101e9563bf247c112157a67e306b06b9517b0422eca521f543d637a6cbd2cea7639e43f13d773b3d2b  tidy-buffio.patch
 199aecdbd3b4035aabf5379c215f82412d3c98b79a1ee186944e7fe1f0ed6f40789ea30e2355149491de6be34fc66c5e486e2a79a7e41ab2ae18706ef3ffe79b  includedir.patch
-82231c7b27b4d044272857dc713674884715ed8e36e54be06faa5d2a949ba4bca597628958a9c5683ec51c36e05a00f6be811c7e95112b0314c98528f584a8d6  pid_log.patch"
+9503514f22d591125fb08da23f4bcc9fc47e9b2cf8b53c6ca0130e1325acce621c21a59a60ab687c87972feba7f0007d52f4bd4790a1aca592383212891c4e7c  pid_log.patch"
diff --git a/community/php7/php7-fpm.initd b/community/php7/php7-fpm.initd
index f56fdb5234..99fccd599f 100644
--- a/community/php7/php7-fpm.initd
+++ b/community/php7/php7-fpm.initd
@@ -6,18 +6,17 @@
 # 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-fpm7"
+command="/usr/sbin/php7-fpm"
 command_background="yes"
 start_stop_daemon_args="--quiet"
-pidfile="/run/$RC_SVCNAME/php-fpm.pid"
+pidfile="/run/$RC_SVCNAME/php7-fpm.pid"
 retry="SIGTERM/20"
 
 # configtest is here only for backward compatibility
-extra_commands="checkconfig configtest"
+extra_commands="checkconfig"
 extra_started_commands="reload reopen"
-description_checkconfig="Run php-fpm config check"
+description="PHP FastCGI Process Manager"
+description_checkconfig="Run config check"
 description_reload="Gracefully reload workers and config"
 description_reopen="Reopen log files"
 
@@ -25,47 +24,43 @@ required_files="$fpm_config"
 
 depend() {
 	need net
-	use apache2 lighttpd nginx
+	before apache2 lighttpd nginx
 }
 
 init_vars() {
 	# Defaults for single master process with multiple pools
-	if [ "$RC_SVCNAME" = "php-fpm7" ]; then
+	if [ "$RC_SVCNAME" = "php7-fpm" ]; then
 		: ${fpm_config:="/etc/php7/php-fpm.conf"}
 		: ${user:="root"}
 	# Defaults for master process per pool
 	else
-		: ${fpm_config="/etc/php7/php-fpm.d/${RC_SVCNAME#php-fpm7.}.conf"}
+		: ${fpm_config="/etc/php7/php-fpm.d/${RC_SVCNAME#php7-fpm.}.conf"}
 		: ${user:="$(conf_get user)"}
 		: ${user:="nobody"}
 		: ${group:="$(conf_get group)"}
 	fi
-	command_args="--nodaemonize --fpm-config $fpm_config"
+	command_args="--nodaemonize --fpm-config $fpm_config --pid $pidfile"
 	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
-
+	[ "${listen:0:1}" = "/" ] && checkpath -d -o $user:$group "$(dirname "$listen")"
 	checkpath -d "$(dirname "$pidfile")"
 }
 
 reload() {
-	ebegin "Reloading $name"
+	ebegin "Reloading $RC_SVCNAME"
 	start-stop-daemon --signal USR2 --pidfile "$pidfile"
 	eend $?
 }
 
 reopen() {
-	ebegin "Reopening $name log files"
+	ebegin "Reopening $RC_SVCNAME log files"
 	start-stop-daemon --signal USR1 --pidfile "$pidfile"
 	eend $?
 }
@@ -73,7 +68,6 @@ reopen() {
 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"
@@ -82,11 +76,6 @@ checkconfig() {
 	}
 }
 
-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/community/php7/php7-fpm.logrotate b/community/php7/php7-fpm.logrotate
index 10e53e4683..4273f72474 100644
--- a/community/php7/php7-fpm.logrotate
+++ b/community/php7/php7-fpm.logrotate
@@ -8,6 +8,6 @@
 	dateext
 	sharedscripts
 	postrotate
-		/etc/init.d/php-fpm7 --ifstarted --quiet reopen
+		/etc/init.d/php7-fpm --ifstarted --quiet reopen
 	endscript
 }
diff --git a/community/php7/php7-module.conf b/community/php7/php7-module.conf
index cf7573bb10..f0a0b47a00 100644
--- a/community/php7/php7-module.conf
+++ b/community/php7/php7-module.conf
@@ -1,4 +1,4 @@
-LoadModule php7_module modules/mod_php7.so
+LoadModule php7_module modules/libphp7.so
 
 DirectoryIndex index.php index.html
 AddHandler application/x-httpd-php .php
diff --git a/community/php7/pid_log.patch b/community/php7/pid_log.patch
index bc586dbd69..b44361db19 100644
--- a/community/php7/pid_log.patch
+++ b/community/php7/pid_log.patch
@@ -14,7 +14,7 @@
  #ifdef HAVE_SYSLOG_H
  	if (!fpm_global_config.syslog_ident) {
 -		fpm_global_config.syslog_ident = strdup("php-fpm");
-+		fpm_global_config.syslog_ident = strdup("php-fpm7");
++		fpm_global_config.syslog_ident = strdup("php7-fpm");
  	}
  
  	if (fpm_global_config.syslog_facility < 0) {
@@ -23,7 +23,7 @@
  			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-fpm7.conf", fpm_globals.prefix);
++			spprintf(&tmp, 0, "%s/etc/php7/php-fpm.conf", fpm_globals.prefix);
  		}
  
  		if (!tmp) {
@@ -34,18 +34,30 @@
  ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
  ; Default Value: none
 -;pid = run/php-fpm.pid
-+;pid = run/php-fpm7.pid
++;pid = run/php7-fpm.pid
  
  ; Error log file
  ; If it's set to "syslog", log is sent to syslogd instead of being written
- ; in a local file.
+ ; into a local file.
  ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
- ; Default Value: log/php-fpm.log
+-; Default Value: log/php-fpm.log
 -;error_log = log/php-fpm.log
++; Default Value: log/php7/error.log
 +;error_log = log/php7/error.log
  
  ; syslog_facility is used to specify what type of program is logging the
  ; message. This lets syslogd specify that messages from different facilities
+@@ -33,8 +33,8 @@
+ ; syslog_ident is prepended to every message. If you have multiple FPM
+ ; instances running on the same server, you can change the default value
+ ; which must suit common needs.
+-; Default Value: php-fpm
+-;syslog.ident = php-fpm
++; Default Value: php7-fpm
++;syslog.ident = php7-fpm
+ 
+ ; Log level
+ ; Possible Values: alert, error, warning, notice, debug
 --- a/sapi/fpm/www.conf.in
 +++ b/sapi/fpm/www.conf.in
 @@ -250,7 +250,7 @@
@@ -71,6 +83,6 @@
  ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email-masked]
  ;php_flag[display_errors] = off
 -;php_admin_value[error_log] = /var/log/fpm-php.www.log
-+;php_admin_value[error_log] = /var/log/php7/www.error.log
++;php_admin_value[error_log] = /var/log/php7/$pool.error.log
  ;php_admin_flag[log_errors] = on
  ;php_admin_value[memory_limit] = 32M
diff --git a/community/php7/tidy-buffio.patch b/community/php7/tidy-buffio.patch
deleted file mode 100644
index c15f9540a4..0000000000
--- a/community/php7/tidy-buffio.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/ext/tidy/tidy.c
-+++ b/ext/tidy/tidy.c
-@@ -31,7 +31,7 @@
- #include "ext/standard/info.h"
- 
- #include "tidy.h"
--#include "buffio.h"
-+#include "tidybuffio.h"
- 
- /* compatibility with older versions of libtidy */
- #ifndef TIDY_CALL
-- 
2.11.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---