]> TLD Linux GIT Repositories - packages/php.git/blobdiff - php.spec
- release 2
[packages/php.git] / php.spec
index 21488f5d34d1467884472814fbc806331e794523..477c246df713b2a162c7ddca5840f0cc281a44b2 100644 (file)
--- a/php.spec
+++ b/php.spec
@@ -1,17 +1,13 @@
-# TODO 5.5:
+# NOTES 
+# - mysqlnd driver doesn't support reconnect: https://bugs.php.net/bug.php?id=52561
+# TODO 7.2:
+# - https://github.com/php/php-src/blob/php-7.2.0/UPGRADING
+# TODO 5.6:
 # - enable --with-fpm-systemd, but ensure it checks for sd_booted()
-# - build with system libgd 2.1, see 73c5128
 # TODO 5.4:
-# - do not remove PatchX: definitions until merged to HEAD, needed for tracking their state
-# - check php-sapi-ini-file.patch for safe mode removal
 # - update imap annotations patch (needs api porting)
 # - update imap myrights patch (needs api porting)
 # --with-libmbfl=DIR      MBSTRING: Use external libmbfl.  DIR is the libmbfl base install directory BUNDLED
-# --with-onig=DIR         MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
-# - uses libvpx for webp support, should use libwebp-devel instead?
-# NOTE: mysqlnd does not support ssl or compression (see FAQ at http://dev.mysql.com/downloads/connector/php-mysqlnd/)
-# UNPACKAGED EXTENSION NOTES:
-# - com_dotnet is Win32-only
 # TODO:
 # - fileinfo extension bundles magic db in library: data_file.c (dump of magic.mgc) is 14M
 #   - 2.3M fileinfo.so php54-fileinfo-5.4.6-0.15.x86_64
 #   -  13K fileinfo.so php-pecl-fileinfo-1.0.4-8.amd64
 # - ttyname_r() misdetected http://bugs.php.net/bug.php?id=48820
 # - wddx: restore session support (not compiled in due DL extension check)
-# - deal with modules removed from php and not moved to PECL, still not obsoleted anywhere
-#   - removed from php 5.0 (currently in php4):
-#   db [pecl-svn], hyperwave [pecl-svn], java [pecl-svn], mcal [pecl-svn], qtdom [pecl-svn]
-#   - removed from php 5.1:
-#   oracle [pecl-svn]
-#   - removed from php 5.2:
-#   filepro [pecl-svn], hwapi [pecl-svn]
-# - make additional headers and checking added by mail patch configurable
 # - modularize standard (output from pure php -m)?
-# - lib64 patch obsolete by $PHP_LIBDIR ?
-# - WARNING: Phar: sha256/sha512 signature support disabled if ext/hash is
-#   built shared, also PHAR_HAVE_OPENSSL is false if openssl is built shared.
-#   make it runtime dep and add Suggests (or php warning messages)
 # - some mods should be shared:
 #$ php -m
 # [PHP Modules]
-#+Core
+# Core
 # date
-#+ereg
 # libxml
 # Reflection
+# standard
 #
 # Conditional build:
-
-%bcond_without default_php     # use this PHP as default PHP in distro
-%bcond_with    interbase_inst  # use InterBase install., not Firebird  (BR: proprietary libs)
-%bcond_with    oci8            # with Oracle oci8 extension module     (BR: proprietary libs)
-%bcond_with    instantclient   # build Oracle oci8 extension module against oracle-instantclient package
-%bcond_with    system_gd       # with system gd (we prefer internal since it enables few more features)
-%bcond_with    system_libzip   # with system libzip (reported broken currently)
+# - General options:
+%bcond_without embed           # disable building Embedded API
+%bcond_with    gcov            # Enable Code coverage reporting
+%bcond_without kerberos5       # without Kerberos5 support
+%bcond_with    suhosin         # with suhosin patch, has little point in PHP>=5.3, see https://github.com/stefanesser/suhosin/issues/42#issuecomment-41728178
+%bcond_with    systemtap       # systemtap/DTrace support
+%bcond_with    tests           # default off; test process very often hangs on builders, approx run time 45m; perform "make test"
+%bcond_with    zts             # Zend Thread Safety
+# - SAPI
+%bcond_without apache2         # disable building Apache 2.x SAPI
+%bcond_without cgi             # disable CGI/FCGI SAPI
+%bcond_without fpm             # disable FPM SAPI
+%bcond_without litespeed       # build litespeed SAPI
+%bcond_with    milter          # disable Milter SAPI
+%bcond_without phpdbg          # disable phpdbg SAPI
+# - Extensions
+%bcond_without bcmath          # without bcmath extension module
+%bcond_without bz2             # without bz2 extension module
+%bcond_without calendar        # without calendar extension module
+%bcond_without ctype           # without ctype extension module
 %bcond_without curl            # without CURL extension module
+%bcond_without dba             # without DBA extension module
+%bcond_without dom             # without DOM extension module
 %bcond_without enchant         # without Enchant extension module
+%bcond_without exif            # without EXIF extension module
+%bcond_without fileinfo        # without fileinfo extension module
 %bcond_without filter          # without filter extension module
+%bcond_without ftp             # without FTP extension module
+%bcond_without gd              # without GD extension module
+%bcond_without gettext         # without gettext extension module
+%bcond_without gmp             # without gmp extension module
+%bcond_without hash            # without hash extension module
+%bcond_without iconv           # without iconv extension module
 %bcond_without imap            # without IMAP extension module
 %bcond_without interbase       # without InterBase extension module
 %bcond_without intl            # without Intl extension module
-%bcond_without kerberos5       # without Kerberos5 support
-%bcond_without litespeed       # build litespeed module
+%bcond_without json            # without json extension module
 %bcond_without ldap            # without LDAP extension module
+%bcond_without mbstring        # without mbstring extension module
 %bcond_without mhash           # without mhash extension (supported by hash extension)
-%bcond_without mm              # without mm support for session storage
-%bcond_without mssql           # without MS SQL extension module
-# don't turn it on by default; see TODO item for mysqlnd in this spec
-%bcond_with    mysqlnd         # with mysqlnd support in mysql related extensions
-%bcond_without mysqli          # without mysqli support (Requires mysql > 4.1)
+%bcond_without mysqli          # without mysqli support (Requires mysql >= 4.1)
+%bcond_without mysqlnd         # without mysqlnd support in mysql related extensions
+%bcond_with    oci             # with Oracle oci8 extension module     (BR: proprietary libs)
 %bcond_without odbc            # without ODBC extension module
 %bcond_without opcache         # without Enable Zend OPcache extension support
 %bcond_without openssl         # without OpenSSL support and OpenSSL extension (module)
+%bcond_without pcntl           # without pcntl extension module
 %bcond_without pcre            # without PCRE extension module
+%bcond_without pdo             # without PDO extension module
+%bcond_without pdo_dblib       # without PDO dblib extension module
+%bcond_without pdo_mysql       # without PDO MySQL extension module
 %bcond_without pdo_sqlite      # without PDO SQLite extension module
 %bcond_without pgsql           # without PostgreSQL extension module
-%bcond_without phar            # without phar extension module
+%bcond_without phar            # without Phar extension module
+%bcond_without posix           # without POSIX extension module
 %bcond_without pspell          # without pspell extension module
+%bcond_without readline        # without readline extension module
 %bcond_without recode          # without recode extension module
+%bcond_without session         # without session extension module
 %bcond_without snmp            # without SNMP extension module
+%bcond_without sodium          # without sodium extension module
 %bcond_without sqlite2         # without SQLite extension module
 %bcond_without sqlite3         # without SQLite3 extension module
-%bcond_without sybase_ct       # without Sybase-CT extension module
 %bcond_without tidy            # without Tidy extension module
-%bcond_without webp            # Without WebP support in GD extension (imagecreatefromwebp)
 %bcond_without wddx            # without WDDX extension module
 %bcond_without xmlrpc          # without XML-RPC extension module
-%bcond_without apache1         # disable building Apache 1.3.x SAPI
-%bcond_without apache2         # disable building Apache 2.x SAPI
-%bcond_with    zts             # Zend Thread Safety
-%bcond_without cgi             # disable CGI/FCGI SAPI
-%bcond_without fpm             # disable FPM
-%bcond_with    embed           # disable Embedded API
-%bcond_without suhosin         # with suhosin patch
-%bcond_with    tests           # default off; test process very often hangs on builders, approx run time 45m; perform "make test"
-%bcond_with    gcov            # Enable Code coverage reporting
-%bcond_with    type_hints      # experimental support for strict typing/casting
+%bcond_without xsl             # without xsl extension module
+# extensions options
+%bcond_without argon2          # argon2 password hashing
+%bcond_without instantclient   # build Oracle oci8 extension module against oracle-instantclient package
+%bcond_with    interbase_inst  # use InterBase install., not Firebird  (BR: proprietary libs)
+%bcond_with    mm              # without mm support for session storage
+%bcond_without system_gd       # system gd
+%bcond_without system_libzip   # system libzip
+%bcond_without webp            # Without WebP support in GD extension (imagecreatefromwebp)
 
 %define apxs1          /usr/sbin/apxs1
 %define        apxs2           /usr/sbin/apxs
 
 # disable all sapis
 %if %{with gcov}
-%undefine      with_apache1
 %undefine      with_apache2
 %undefine      with_cgi
 %undefine      with_litespeed
 %undefine      with_mm
 %endif
 
-%ifnarch %{ix86} %{x8664} sparc sparcv9 alpha
+# milter requires ZTS
+%if %{with milter} && %{without zts}
+%undefine      with_milter
+%endif
+
+%ifnarch %{ix86} %{x8664} x32 sparc sparcv9 alpha
 # ppc disabled (broken on th-ppc)
 %undefine      with_interbase
 %endif
 
-%ifnarch %{ix86} %{x8664}
+%ifnarch %{ix86} %{x8664} x32
 # unsupported, see sapi/cgi/fpm/fpm_atomic.h
 %undefine      with_fpm
 %endif
 
-%if 0
-%if %{without apache1} && %{without apache2}
-ERROR: You need to select at least one Apache SAPI to build shared modules.
-%endif
-%endif
-
 # filter depends on pcre
 %if %{without pcre}
 %undefine      with_filter
 %endif
 
-%define                rel     1
 %define                orgname php
-%define                ver_suffix 55
-%define                php_suffix %{!?with_default_php:%{ver_suffix}}
+%define                php_suffix 73
 Summary:       PHP: Hypertext Preprocessor
 Summary(fr.UTF-8):     Le langage de script embarque-HTML PHP
 Summary(pl.UTF-8):     Język skryptowy PHP
 Summary(pt_BR.UTF-8):  A linguagem de script PHP
-Summary(ru.UTF-8):     PHP Версии 5 - язык препроцессирования HTML-файлов, выполняемый на сервере
-Summary(uk.UTF-8):     PHP Версії 5 - мова препроцесування HTML-файлів, виконувана на сервері
+Summary(ru.UTF-8):     PHP Версии 7 - язык препроцессирования HTML-файлов, выполняемый на сервере
+Summary(uk.UTF-8):     PHP Версії 7 - мова препроцесування HTML-файлів, виконувана на сервері
 Name:          %{orgname}%{php_suffix}
-Version:       5.5.14
-Release:       %{rel}%{?with_type_hints:.th}%{?with_oci8:.oci}
+Version:       7.3.10
+Release:       2
 Epoch:         4
-License:       PHP
-Group:         Libraries
-Source0:       http://www.php.net/distributions/%{orgname}-%{version}.tar.bz2
-# Source0-md5: b53e5f47c59ffbe26d20957636695baa
-Source2:       %{orgname}-mod_%{orgname}.conf
+# All files licensed under PHP version 3.01, except
+# Zend is licensed under Zend
+# TSRM is licensed under BSD
+License:       PHP 3.01 and Zend and BSD
+Group:         Libraries
+Source0:       http://php.net/distributions/%{orgname}-%{version}.tar.xz
+# Source0-md5: cce77c52ba74507807cf9d66be9ee7cd
+Source1:       opcache.ini
+Source2:       %{orgname}-mod_php.conf
 Source3:       %{orgname}-cgi-fcgi.ini
 Source4:       %{orgname}-apache.ini
 Source5:       %{orgname}-cli.ini
-# Taken from: http://browsers.garykeith.com/downloads.asp
-Source9:       %{orgname}_browscap.ini
 Source10:      %{orgname}-fpm.init
 Source11:      %{orgname}-fpm.logrotate
 Source12:      %{orgname}-branch.sh
@@ -160,37 +168,27 @@ Source13: dep-tests.sh
 Source14:      skip-tests.sh
 Patch0:                %{orgname}-shared.patch
 Patch1:                %{orgname}-tld.patch
-Patch2:                %{orgname}-mail.patch
 Patch3:                %{orgname}-link-libs.patch
-Patch4:                %{orgname}-libpq_fs_h_path.patch
+Patch4:                intl-stdc++.patch
 Patch5:                %{orgname}-filter-shared.patch
-Patch6:                %{orgname}-build_modules.patch
 Patch7:                %{orgname}-sapi-ini-file.patch
-Patch9:                %{orgname}-sh.patch
+Patch8:                milter.patch
+Patch9:                libtool-tag.patch
 Patch10:       %{orgname}-ini.patch
 Patch11:       embed.patch
-%if %{with type_hints}
-Patch12:       http://ilia.ws/patch/type_hint_53_v2.txt
-%endif
 Patch14:       %{orgname}-no_pear_install.patch
-#Patch15:      %{orgname}-zlib.patch # no longer needed?
 Patch17:       %{orgname}-readline.patch
 Patch18:       %{orgname}-nohttpd.patch
-Patch19:       %{orgname}-gd_imagerotate_enable.patch
-Patch20:       %{orgname}-uint32_t.patch
 Patch21:       %{orgname}-dba-link.patch
 Patch22:       %{orgname}-both-apxs.patch
-Patch23:       %{orgname}-builddir.patch
+Patch23:       %{orgname}-paths.patch
 Patch24:       %{orgname}-zlib-for-getimagesize.patch
 Patch25:       %{orgname}-stupidapache_version.patch
 Patch26:       %{orgname}-pear.patch
 Patch27:       %{orgname}-config-dir.patch
 Patch29:       %{orgname}-fcgi-graceful.patch
 Patch31:       %{orgname}-fcgi-error_log-no-newlines.patch
-#Patch32:      %{orgname}-curl-limit-speed.patch # applied upstream
 Patch34:       %{orgname}-libtool.patch
-Patch35:       %{orgname}-tds.patch
-Patch36:       %{orgname}-mysql-charsetphpini.patch
 Patch37:       %{orgname}-mysqli-charsetphpini.patch
 Patch38:       %{orgname}-pdo_mysql-charsetphpini.patch
 Patch39:       %{orgname}-use-prog_sendmail.patch
@@ -198,136 +196,127 @@ Patch41:        %{orgname}-fpm-config.patch
 Patch42:       %{orgname}-fpm-shared.patch
 Patch43:       %{orgname}-silent-session-cleanup.patch
 Patch44:       %{orgname}-include_path.patch
-Patch45:       %{orgname}-imap-annotations.patch
-Patch46:       %{orgname}-imap-myrights.patch
 Patch47:       suhosin.patch
-#Patch49:      %{orgname}-m4-divert.patch # no longer needed, upstream supports new ac
 Patch50:       extension-shared-optional-dep.patch
 Patch51:       spl-shared.patch
 Patch52:       pcre-shared.patch
 Patch53:       fix-test-run.patch
-#Patch54:      mysqlnd-shared.patch # shared build supported upstream
 Patch55:       bug-52078-fileinode.patch
-#Patch57:      bug-52448.patch # outdated
 Patch59:       %{orgname}-systzdata.patch
-Patch60:       %{orgname}-oracle-instantclient.patch
-#Patch61:      %{orgname}-krb5-ac.patch # not needed on 5.4 anymore
-Patch62:       mcrypt-libs.patch
-Patch63:       %{orgname}-mysql-nowarning.patch
-#Patch64:      %{orgname}-m4.patch # not needed on 5.4 branch
-Patch65:       system-libzip.patch
 Patch66:       php-db.patch
-URL:           http://www.php.net/
+Patch67:       mysql-lib-ver-mismatch.patch
+Patch69:       fpm-conf-split.patch
+Patch70:       mysqlnd-ssl.patch
+Patch71:       libdb-info.patch
+Patch72:       phar-hash-shared.patch
+URL:           http://php.net/
 %{?with_interbase:%{!?with_interbase_inst:BuildRequires:       Firebird-devel >= 1.0.2.908-2}}
 %{?with_pspell:BuildRequires:  aspell-devel >= 2:0.50.0}
 BuildRequires: autoconf >= 2.59
 BuildRequires: automake >= 1.4d
 BuildRequires: bison
-BuildRequires: bzip2-devel
+BuildRequires: bzip2-devel >= 1.0.0
 %{?with_curl:BuildRequires:    curl-devel >= 7.12.0}
-BuildRequires: cyrus-sasl-devel
+BuildRequires: cyrus-sasl-devel >= 2
 BuildRequires: db-devel >= 4.0
 BuildRequires: elfutils-devel
 %{?with_enchant:BuildRequires: enchant-devel >= 1.1.3}
-#BuildRequires:        fcgi-devel
 %{?with_kerberos5:BuildRequires:       heimdal-devel}
-%{?with_system_libzip:BuildRequires:   libzip-devel >= 0.10.1-2}
-%{!?with_mysqlnd:BuildRequires:        mysql-devel}
-BuildRequires: pkgconfig
-BuildRequires: sed >= 4.0
-%if %{with mssql} || %{with sybase_ct}
+%{?with_argon2:BuildRequires:  libargon2-devel >= 20161029}
+%{?with_sodium:BuildRequires:  libsodium-devel >= 1.0.8}
+%if %{with pdo_dblib}
 BuildRequires: freetds-devel >= 0.82
 %endif
-BuildRequires: freetype-devel >= 2.0
+BuildRequires: freetype-devel >= 1:2.5.1
 %if %{with system_gd}
 BuildRequires: gd-devel >= 2.1
 %endif
 BuildRequires: gdbm-devel
-BuildRequires: gmp-devel
+BuildRequires: gmp-devel >= 4.2
 %{?with_imap:BuildRequires:    imap-devel >= 1:2007e-2}
+%{?with_gcov:BuildRequires:    lcov}
+%{?with_fpm:BuildRequires:     libapparmor-devel}
 %{?with_intl:BuildRequires:    libicu-devel >= 4.4}
 BuildRequires: libjpeg-devel
 BuildRequires: libltdl-devel >= 1.4
-BuildRequires: libmcrypt-devel >= 2.4.4
 BuildRequires: libpng-devel >= 1.0.8
-#BuildRequires:        libtiff-devel
-%{?with_webp:BuildRequires:    libvpx-devel}
-BuildRequires: tokyocabinet-devel
-BuildRequires: libtool >= 2:2.2
-#BuildRequires:        libwrap-devel
+%{?with_intl:BuildRequires:    libstdc++-devel}
+%{?with_webp:BuildRequires:    libwebp-devel}
+BuildRequires: libtool >= 2:2.4.6
 BuildRequires: libxml2-devel >= 1:2.7.6-4
-BuildRequires: libxslt-devel >= 1.1.0
+%{?with_xsl:BuildRequires:     libxslt-devel >= 1.1.0}
+%{?with_system_libzip:BuildRequires:   libzip-devel >= 1.2.0}
+%{?with_snmp:%{?with_tests:BuildRequires:      mibs-net-snmp}}
 %{?with_mm:BuildRequires:      mm-devel >= 1.3.0}
+%{!?with_pdo_mysql:BuildRequires:      mysql-devel}
+%{!?with_mysqli:BuildRequires: mysql-devel >= 4.1.13}
+%{?with_snmp:BuildRequires:    net-snmp-devel >= 5.3}
+BuildRequires: oniguruma-devel
 %{?with_ldap:BuildRequires:    openldap-devel >= 2.3.0}
 %if %{with openssl} || %{with ldap}
-BuildRequires: openssl-devel >= 0.9.7d
+BuildRequires: openssl-devel >= 1.0.1
 %endif
-%{?with_gcov:BuildRequires:    lcov}
-%{?with_snmp:%{?with_tests:BuildRequires:      mibs-net-snmp}}
-%{?with_snmp:BuildRequires:    net-snmp-devel >= 5.0.7}
-%{?with_instantclient:BuildRequires:   oracle-instantclient-devel}
+%{?with_oci:%{?with_instantclient:BuildRequires:       oracle-instantclient-devel}}
 BuildRequires: pam-devel
 %{?with_pcre:BuildRequires:    pcre-devel >= 8.10}
 BuildRequires: pkgconfig
-%{?with_pgsql:BuildRequires:   postgresql-backend-devel >= 7.2}
 %{?with_pgsql:BuildRequires:   postgresql-devel}
 BuildRequires: readline-devel
 %{?with_recode:BuildRequires:  recode-devel >= 3.5d-3}
 BuildRequires: rpm >= 4.4.9-56
 BuildRequires: rpm-build >= 4.4.0
 BuildRequires: rpmbuild(macros) >= 1.566
-BuildRequires: tar >= 1:1.22
-BuildRequires: xz
+BuildRequires: sed >= 4.0
 %if %{with sqlite3} || %{with pdo_sqlite}
 BuildRequires: sqlite3-devel >= 3.3.9
 %endif
-BuildRequires: t1lib-devel
+%{?with_systemtap:BuildRequires:       systemtap-sdt-devel}
+BuildRequires: tar >= 1:1.22
 %{?with_tidy:BuildRequires:    tidy-devel}
+BuildRequires: tokyocabinet-devel
 %{?with_odbc:BuildRequires:    unixODBC-devel}
 %{?with_xmlrpc:BuildRequires:  xmlrpc-epi-devel >= 0.54.1}
-BuildRequires: zlib-devel >= 1.0.9
-%if %{with apache1}
-BuildRequires: apache1-devel
-%endif
+BuildRequires: xz
+BuildRequires: zlib-devel >= 1.2.0.4
 %if %{with apache2}
 BuildRequires: apache-devel >= 2.0.52-2
 BuildRequires: apr-devel >= 1:1.0.0
 BuildRequires: apr-util-devel >= 1:1.0.0
 %endif
-%if %{with fpm}
-#BuildRequires:        judy-devel
-%endif
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define                php_sysconfdir          /etc/%{name}
 %define                php_extensiondir        %{_libdir}/%{name}
-%define                _sysconfdir                     %{php_sysconfdir}
+%define                php_datadir             /usr/share/php/%{name}
+%define                _sysconfdir             %{php_sysconfdir}
 
 # must be in sync with source. extra check ensuring that it is so is done in %%build
-%define                php_api_version         20121113
-%define                zend_module_api         20121212
-%define                zend_extension_api      220121212
+%define                php_api_version         20180731
+%define                zend_module_api         20180731
+%define                zend_extension_api      320180731
+%define                php_pdo_api_version     20170320
 
 # Extension versions
-%define                bz2ver          1.0
-%define                enchantver      1.1.0
-%define                fileinfover     1.0.5
-%define                hashver         1.0
-%define                intlver         1.1.0
-%define                jsonver         1.2.1
-%define                opcachever      7.0.4-dev
-%define                pharver         2.0.2
-%define                sqlite3ver      0.7-dev
-%define                zipver          1.11.0
-
-%define                zend_zts                %{!?with_zts:0}%{?with_zts:1}
+%define                bz2ver          %{version}
+%define                enchantver      %{version}
+%define                fileinfover     %{version}
+%define                hashver         %{version}
+%define                intlver         %{version}
+%define                jsonver         1.7.0
+%define                pharver         %{version}
+%define                sqlite3ver      %{version}
+%define                zipver          1.15.4
+%define                phpdbgver       0.5.0
+%define                sodiumver       %{version}
+
+%define                _zend_zts               %{!?with_zts:0}%{?with_zts:1}
 %define                php_debug               %{!?debug:0}%{?debug:1}
 
 %if %{with gcov}
 %undefine      with_ccache
 %endif
 
-%if %{with oci8}
+%if %{with oci}
 # ORACLE_HOME is required for oci8 ext to build
 %define _preserve_env %_preserve_env_base ORACLE_HOME
 %endif
@@ -385,24 +374,6 @@ PHP - це мова написання скриптів, що вбудовуют
 роботи з базами даних є доволі простим. Найбільш популярне
 використання PHP - заміна для CGI скриптів.
 
-%package -n apache1-mod_%{name}
-Summary:       PHP DSO module for Apache 1.3.x
-Summary(pl.UTF-8):     Moduł DSO (Dynamic Shared Object) PHP dla Apache 1.3.x
-Group:         Development/Languages/PHP
-Requires(triggerpostun):       sed >= 4.0
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Requires:      apache1(EAPI) >= 1.3.33-2
-Requires:      apache1-mod_mime
-Provides:      webserver(php) = %{version}
-Obsoletes:     apache-mod_php < 1:4.1.1
-Obsoletes:     phpfi
-
-%description -n apache1-mod_%{name}
-PHP as DSO module for Apache 1.3.x.
-
-%description -n apache1-mod_%{name} -l pl.UTF-8
-PHP jako moduł DSO (Dynamic Shared Object) dla Apache 1.3.x.
-
 %package -n apache-mod_%{name}
 Summary:       PHP DSO module for Apache 2.x
 Summary(pl.UTF-8):     Moduł DSO (Dynamic Shared Object) PHP dla Apache 2.x
@@ -411,6 +382,7 @@ Requires:   %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      apache(modules-api) = %{apache_modules_api}
 Requires:      apache-mod_mime
 Provides:      webserver(php) = %{version}
+Obsoletes:     apache-mod_php < 4:5.3.28-7
 Obsoletes:     phpfi
 
 %description -n apache-mod_%{name}
@@ -424,7 +396,9 @@ Summary:    PHP for litespeed HTTP server
 Summary(pl.UTF-8):     PHP dla serwera HTTP litespeed
 Group:         Development/Languages/PHP
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Provides:      php(litespeed)
 Provides:      webserver(php) = %{version}
+Obsoletes:     php-litespeed < 4:5.3.28-7
 
 %description litespeed
 PHP for litespeed HTTP server.
@@ -441,8 +415,8 @@ Provides:   %{name}-fcgi = %{epoch}:%{version}-%{release}
 Provides:      php(cgi)
 Provides:      php(fcgi)
 Provides:      webserver(php) = %{version}
+Obsoletes:     php-cgi < 4:5.3.28-7
 Obsoletes:     php-fcgi < 4:5.3.0
-Conflicts:     logrotate < 3.8.0
 
 %description cgi
 PHP as CGI or FastCGI program.
@@ -455,7 +429,8 @@ Summary:    PHP as CLI interpreter
 Summary(pl.UTF-8):     PHP jako interpreter działający z linii poleceń
 Group:         Development/Languages/PHP
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Provides:      php-program
+Requires:      alternatives
+Obsoletes:     php-cli < 4:5.3.28-7
 
 %description cli
 PHP as CLI interpreter.
@@ -468,6 +443,7 @@ Summary:    PHP library for embedding in applications
 Summary(pl.UTF-8):     Biblioteka PHP do osadzania w aplikacjach
 Group:         Libraries
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Obsoletes:     php-embedded < 4:5.3.28-7
 
 %description embedded
 The php-embedded package contains a library which can be embedded into
@@ -481,15 +457,21 @@ celu obsługi PHP jako języka skryptowego.
 Summary:       PHP FastCGI Process Manager
 Summary(pl.UTF-8):     PHP FastCGI Process Manager - zarządca procesów FastCGI
 Group:         Development/Languages/PHP
-URL:           http://www.php-fpm.org/
+URL:           http://php-fpm.org/
 Requires(post,preun):  /sbin/chkconfig
 Requires(postun):      /usr/sbin/userdel
 Requires(pre): /bin/id
 Requires(pre): /usr/sbin/useradd
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Requires:      alternatives
+Requires:      php-dirs >= 1.4-2
 Requires:      rc-scripts
+Provides:      php(fcgi)
+Provides:      php(fpm)
 Provides:      user(http)
 Provides:      webserver(php) = %{version}
+Obsoletes:     php-fpm < 4:5.3.28-7
+Conflicts:     logrotate < 3.8.0
 
 %description fpm
 PHP FastCGI Process Manager.
@@ -497,6 +479,32 @@ PHP FastCGI Process Manager.
 %description fpm -l pl.UTF-8
 PHP FastCGI Process Manager - zarządca procesów FastCGI.
 
+%package phpdbg
+Summary:       The debugging platform for PHP 5.4+
+Summary(pl.UTF-8):     Platforma diagnostyczna dla PHP 5.4+
+Group:         Development/Languages/PHP
+Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Provides:      php(phpdbg) = %{phpdbgver}
+
+%description phpdbg
+phpdbg - The interactive PHP debugger.
+
+Implemented as a SAPI module, phpdbg can excert complete control over
+the environment without impacting the functionality or performance of
+your code.
+
+phpdbg aims to be a lightweight, powerful, easy to use debugging
+platform for PHP 5.4+
+
+%description phpdbg -l pl.UTF-8
+phpdbg - interaktywny debugger dla PHP.
+
+Jest zaimplementowany jako moduł SAPI, potrafi przejąć pełną kontrolę
+nad środowiskiem bez wpływu na zachowanie lub wydajność kodu.
+
+Narzędzie powstało jako lekka, mająca duże możliwości, łatwa w użyciu
+platforma diagnostyczna dla PHP 5.4+.
+
 %package common
 Summary:       Common files needed by both Apache modules and CGI/CLI SAPIs
 Summary(pl.UTF-8):     Wspólne pliki dla modułu Apache'a i programu CGI
@@ -509,27 +517,35 @@ Requires: glibc >= 6:2.3.5
 Requires:      php-dirs >= 1.4
 Requires:      rpm-whiteout >= 1.28
 Requires:      tzdata
+Requires:      zlib >= 1.2.0.4
 Provides:      %{name}(debug) = %{php_debug}
 Provides:      %{name}(modules_api) = %{php_api_version}
-Provides:      %{name}(thread-safety) = %{zend_zts}
+Provides:      %{name}(thread-safety) = %{_zend_zts}
 Provides:      %{name}(zend_extension_api) = %{zend_extension_api}
 Provides:      %{name}(zend_module_api) = %{zend_module_api}
 Provides:      %{name}-core
 Provides:      %{name}-date
-Provides:      %{name}-ereg
 Provides:      %{name}-reflection
 Provides:      %{name}-standard
 Provides:      php(core) = %{version}
 Provides:      php(date)
-Provides:      php(ereg)
-Provides:      php(hash)
 Provides:      php(libxml)
 Provides:      php(reflection)
 Provides:      php(standard)
-%{!?with_mysqlnd:Obsoletes:    php-mysqlnd}
+%{!?with_mysqlnd:Obsoletes:    %{name}-mysqlnd}
 %{?with_pcre:%requires_ge_to   pcre pcre-devel}
+Suggests:      browscap
+Obsoletes:     php-common < 4:5.3.28-7
+# withdrawn modules
+Obsoletes:     php-filepro < 4:5.2.0
+Obsoletes:     php-hwapi < 4:5.2.0
+Obsoletes:     php-hyperwave < 3:5.0.0
+Obsoletes:     php-java < 3:5.0.0
+Obsoletes:     php-mcal < 3:5.0.0
 Obsoletes:     php-pecl-domxml
+Obsoletes:     php-qtdom < 3:5.0.0
 Conflicts:     php4-common < 3:4.4.4-8
+Conflicts:     php55-common < 4:5.5.10-4
 Conflicts:     rpm < 4.4.2-0.2
 
 %description common
@@ -556,13 +572,16 @@ Group:            Development/Languages/PHP
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      autoconf >= 2.13
 Requires:      automake
-Requires:      libtool >= 2:2.2
+Requires:      libtool >= 2:2.4.6
 %{?with_pcre:Requires: pcre-devel >= 8.10}
 Requires:      shtool
-Obsoletes:     php-devel
+Provides:      php-devel = %{epoch}:%{version}-%{release}
 Obsoletes:     php-pear-devel
 Obsoletes:     php4-devel
 Obsoletes:     php52-devel
+Obsoletes:     php53-devel
+Obsoletes:     php54-devel
+Obsoletes:     php55-devel
 
 %description devel
 The php-devel package lets you compile dynamic extensions to PHP.
@@ -601,9 +620,10 @@ oracle, встановіть цей пакет для компіляції ок
 Summary:       bcmath extension module for PHP
 Summary(pl.UTF-8):     Moduł bcmath dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.bc.php
+URL:           http://php.net/manual/en/book.bc.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(bcmath)
+Obsoletes:     php-bcmath < 4:5.3.28-7
 
 %description bcmath
 This is a dynamic shared object (DSO) for PHP that will add bc style
@@ -617,11 +637,13 @@ matematycznych takich jak w programie bc.
 Summary:       Bzip2 extension module for PHP
 Summary(pl.UTF-8):     Moduł bzip2 dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.bzip2.php
+URL:           http://php.net/manual/en/book.bzip2.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Requires:      bzip2-libs >= 1.0.0
 Provides:      php(bz2) = %{bz2ver}
 Provides:      php(bzip2)
 Provides:      php-bzip2 = %{epoch}:%{version}-%{release}
+Obsoletes:     php-bz2 < 4:5.3.28-7
 Obsoletes:     php-bzip2 < 4:5.2.14-3
 Obsoletes:     php-pecl-bz2 < %{bz2ver}
 
@@ -636,9 +658,10 @@ Moduł PHP umożliwiający używanie kompresji bzip2.
 Summary:       Calendar extension module for PHP
 Summary(pl.UTF-8):     Moduł funkcji kalendarza dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.calendar.php
+URL:           http://php.net/manual/en/book.calendar.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(calendar)
+Obsoletes:     php-calendar < 4:5.3.28-7
 
 %description calendar
 This is a dynamic shared object (DSO) for PHP that will add calendar
@@ -651,9 +674,10 @@ Moduł PHP dodający wsparcie dla kalendarza.
 Summary:       ctype extension module for PHP
 Summary(pl.UTF-8):     Moduł ctype dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.ctype.php
+URL:           http://php.net/manual/en/book.ctype.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(ctype)
+Obsoletes:     php-ctype < 4:5.3.28-7
 
 %description ctype
 This is a dynamic shared object (DSO) for PHP that will add ctype
@@ -666,9 +690,11 @@ Moduł PHP umożliwiający korzystanie z funkcji ctype.
 Summary:       curl extension module for PHP
 Summary(pl.UTF-8):     Moduł curl dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.curl.php
+URL:           http://php.net/manual/en/book.curl.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Requires:      curl-libs >= 7.12.0
 Provides:      php(curl)
+Obsoletes:     php-curl < 4:5.3.28-7
 
 %description curl
 This is a dynamic shared object (DSO) for PHP that will add curl
@@ -681,9 +707,12 @@ Moduł PHP umożliwiający korzystanie z biblioteki curl.
 Summary:       DBA extension module for PHP
 Summary(pl.UTF-8):     Moduł DBA dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.dba.php
+URL:           http://php.net/manual/en/book.dba.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(dba)
+Obsoletes:     php-dba < 4:5.3.28-7
+# withdrawn module of similar functionality but different API
+Obsoletes:     php-db < 3:5.0.0
 
 %description dba
 This is a dynamic shared object (DSO) for PHP that will add flat-file
@@ -697,12 +726,13 @@ Moduł dla PHP dodający obsługę dla baz danych opartych na plikach
 Summary:       DOM extension module for PHP
 Summary(pl.UTF-8):     Moduł DOM dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.dom.php
+URL:           http://php.net/manual/en/book.dom.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(dom)
 # it has some compatibility functions
 Provides:      %{name}-domxml = %{epoch}:%{version}-%{release}
 Provides:      php(domxml)
+Obsoletes:     php-dom < 4:5.3.28-7
 Obsoletes:     php-domxml <= 3:4.3.8-1
 
 %description dom
@@ -716,9 +746,10 @@ Moduł PHP dodający nową obsługę DOM.
 Summary:       libenchant binder
 Summary(pl.UTF-8):     dowiązania biblioteki libenchant
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.exif.php
+URL:           http://php.net/manual/en/book.enchant.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(enchant) = %{enchantver}
+Obsoletes:     php-enchant < 4:5.3.28-7
 Obsoletes:     php-pecl-enchant < %{enchantver}
 
 %description enchant
@@ -745,9 +776,10 @@ ujednolicone API dla wielu narzędzi sprawdzających pisownię:
 Summary:       exif extension module for PHP
 Summary(pl.UTF-8):     Moduł exif dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.exif.php
+URL:           http://php.net/manual/en/book.exif.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(exif)
+Obsoletes:     php-exif < 4:5.3.28-7
 
 %description exif
 This is a dynamic shared object (DSO) for PHP that will add EXIF tags
@@ -760,10 +792,11 @@ Moduł PHP dodający obsługę znaczników EXIF w plikach obrazków.
 Summary:       libmagic bindings
 Summary(pl.UTF-8):     Wiązania do libmagic
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.fileinfo.php
+URL:           http://php.net/manual/en/book.fileinfo.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pcre = %{epoch}:%{version}-%{release}
 Provides:      php(fileinfo) = %{fileinfover}
+Obsoletes:     php-fileinfo < 4:5.3.28-7
 Obsoletes:     php-mime_magic
 Obsoletes:     php-pecl-fileinfo < %{fileinfover}
 
@@ -786,10 +819,11 @@ pliku oraz kodowania plików tekstowych.
 Summary:       Extension for safely dealing with input parameters
 Summary(pl.UTF-8):     Rozszerzenie do bezpiecznej obsługi danych wejściowych
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.filter.php
+URL:           http://php.net/manual/en/book.filter.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pcre = %{epoch}:%{version}-%{release}
 Provides:      php(filter)
+Obsoletes:     php-filter < 4:5.3.28-7
 Obsoletes:     php-pecl-filter
 
 %description filter
@@ -810,9 +844,10 @@ mogą bezpiecznie używać do dostępu do danych.
 Summary:       FTP extension module for PHP
 Summary(pl.UTF-8):     Moduł FTP dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.ftp.php
+URL:           http://php.net/manual/en/book.ftp.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(ftp)
+Obsoletes:     php-ftp < 4:5.3.28-7
 
 %description ftp
 This is a dynamic shared object (DSO) for PHP that will add FTP
@@ -825,14 +860,14 @@ Moduł PHP dodający obsługę protokołu FTP.
 Summary:       GD extension module for PHP
 Summary(pl.UTF-8):     Moduł GD dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.image.php
+URL:           http://php.net/manual/en/book.image.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 %if %{with system_gd}
-Requires:      gd >= 2.0.28-4
+Requires:      gd >= 2.1
 Requires:      gd(gif)
-Requires:      gd(imagerotate) = 5.2.0
 %endif
 Provides:      php(gd)
+Obsoletes:     php-gd < 4:5.3.28-7
 
 %description gd
 This is a dynamic shared object (DSO) for PHP that will add GD
@@ -846,9 +881,10 @@ tworzenie i obróbkę obrazków.
 Summary:       gettext extension module for PHP
 Summary(pl.UTF-8):     Moduł gettext dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.gettext.php
+URL:           http://php.net/manual/en/book.gettext.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(gettext)
+Obsoletes:     php-gettext < 4:5.3.28-7
 
 %description gettext
 This is a dynamic shared object (DSO) for PHP that will add gettext
@@ -861,9 +897,11 @@ Moduł PHP dodający obsługę lokalizacji przez gettext.
 Summary:       gmp extension module for PHP
 Summary(pl.UTF-8):     Moduł gmp dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.gmp.php
+URL:           http://php.net/manual/en/book.gmp.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Requires:      gmp >= 4.2
 Provides:      php(gmp)
+Obsoletes:     php-gmp < 4:5.3.28-7
 
 %description gmp
 This is a dynamic shared object (DSO) for PHP that will add arbitrary
@@ -877,7 +915,7 @@ liczbach o dowolnej długości.
 Summary:       HASH Message Digest Framework
 Summary(pl.UTF-8):     Szkielet do obliczania skrótów wiadomości
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.gmp.php
+URL:           http://php.net/manual/en/book.gmp.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(hash) = %{hashver}
 %if %{with mhash}
@@ -885,6 +923,7 @@ Provides:   php(mhash)
 Provides:      php-mhash = %{epoch}:%{version}-%{release}
 Obsoletes:     php-mhash < 4:5.3.0
 %endif
+Obsoletes:     php-hash < 4:5.3.28-7
 Obsoletes:     php-pecl-hash < %{hashver}
 
 %description hash
@@ -899,11 +938,12 @@ wiadomości przy użyciu wspólnego interfejsu.
 Summary:       iconv extension module for PHP
 Summary(pl.UTF-8):     Moduł iconv dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.iconv.php
+URL:           http://php.net/manual/en/book.iconv.php
 Requires:      %{_libdir}/gconv
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      iconv
 Provides:      php(iconv)
+Obsoletes:     php-iconv < 4:5.3.28-7
 
 %description iconv
 This is a dynamic shared object (DSO) for PHP that will add iconv
@@ -917,11 +957,12 @@ Summary:  IMAP extension module for PHP
 Summary(pl.UTF-8):     Moduł IMAP dla PHP
 Summary(pt_BR.UTF-8):  Um módulo para aplicações PHP que usam IMAP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.imap.php
+URL:           http://php.net/manual/en/book.imap.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pcre = %{epoch}:%{version}-%{release}
 Requires:      imap-lib >= 1:2007e-2
 Provides:      php(imap)
+Obsoletes:     php-imap < 4:5.3.28-7
 
 %description imap
 This is a dynamic shared object (DSO) for PHP that will add IMAP
@@ -937,10 +978,14 @@ Um módulo para aplicações PHP que usam IMAP.
 Summary:       InterBase/Firebird database module for PHP
 Summary(pl.UTF-8):     Moduł bazy danych InterBase/Firebird dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.ibase.php
+URL:           http://php.net/manual/en/book.ibase.php
+%if %{with interbase_inst}
+%{?requires_php_extension}
+%else
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+%endif
 Provides:      php(interbase)
-%{?with_interbase_inst:Autoreq:        false}
+Obsoletes:     php-interbase < 4:5.3.28-7
 
 %description interbase
 This is a dynamic shared object (DSO) for PHP that will add InterBase
@@ -953,9 +998,10 @@ Moduł PHP umożliwiający dostęp do baz danych InterBase i Firebird.
 Summary:       Internationalization extension (ICU wrapper)
 Summary(pl.UTF-8):     Rozszerzenie do internacjonalizacji (interfejs do ICU)
 Group:         Libraries
-URL:           http://www.php.net/intl
+URL:           http://php.net/intl
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(intl) = %{intlver}
+Obsoletes:     php-intl < 4:5.3.28-7
 Obsoletes:     php-pecl-intl < %{intlver}
 
 %description intl
@@ -974,9 +1020,10 @@ daty/czasu/walut.
 Summary:       PHP C extension for JSON serialization
 Summary(pl.UTF-8):     Rozszerzenie C PHP dla serializacji JSON
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.json.php
+URL:           http://php.net/manual/en/book.json.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(json) = %{jsonver}
+Obsoletes:     php-json < 4:5.3.28-7
 Obsoletes:     php-pecl-json < %{jsonver}
 
 %description json
@@ -992,9 +1039,10 @@ Summary:  LDAP extension module for PHP
 Summary(pl.UTF-8):     Moduł LDAP dla PHP
 Summary(pt_BR.UTF-8):  Um módulo para aplicações PHP que usam LDAP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.ldap.php
+URL:           http://php.net/manual/en/book.ldap.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(ldap)
+Obsoletes:     php-ldap < 4:5.3.28-7
 
 %description ldap
 This is a dynamic shared object (DSO) for PHP that will add LDAP
@@ -1010,9 +1058,10 @@ Um módulo para aplicações PHP que usam LDAP.
 Summary:       mbstring extension module for PHP
 Summary(pl.UTF-8):     Moduł mbstring dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mbstring.php
+URL:           http://php.net/manual/en/book.mbstring.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(mbstring)
+Obsoletes:     php-mbstring < 4:5.3.28-7
 
 %description mbstring
 This is a dynamic shared object (DSO) for PHP that will add multibyte
@@ -1021,66 +1070,17 @@ string support.
 %description mbstring -l pl.UTF-8
 Moduł PHP dodający obsługę ciągów znaków wielobajtowych.
 
-%package mcrypt
-Summary:       mcrypt extension module for PHP
-Summary(pl.UTF-8):     Moduł mcrypt dla PHP
-Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mcrypt.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Provides:      php(mcrypt)
-
-%description mcrypt
-This is a dynamic shared object (DSO) for PHP that will add mcrypt
-support.
-
-%description mcrypt -l pl.UTF-8
-Moduł PHP dodający możliwość szyfrowania poprzez bibliotekę mcrypt.
-
-%package mssql
-Summary:       MS SQL extension module for PHP
-Summary(pl.UTF-8):     Moduł MS SQL dla PHP
-Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mssql.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Provides:      php(mssql)
-
-%description mssql
-This is a dynamic shared object (DSO) for PHP that will add MS SQL
-databases support through FreeTDS library.
-
-%description mssql -l pl.UTF-8
-Moduł PHP dodający obsługę baz danych MS SQL poprzez bibliotekę
-FreeTDS.
-
-%package mysql
-Summary:       MySQL database module for PHP
-Summary(pl.UTF-8):     Moduł bazy danych MySQL dla PHP
-Summary(pt_BR.UTF-8):  Um módulo para aplicações PHP que usam bancos de dados MySQL
-Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mysql.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-%{?with_mysqlnd:Requires:      %{name}-mysqlnd = %{epoch}:%{version}-%{release}}
-Provides:      php(mysql)
-
-%description mysql
-This is a dynamic shared object (DSO) for PHP that will add MySQL
-database support.
-
-%description mysql -l pl.UTF-8
-Moduł PHP umożliwiający dostęp do bazy danych MySQL.
-
-%description mysql -l pt_BR.UTF-8
-Um módulo para aplicações PHP que usam bancos de dados MySQL.
-
 %package mysqli
 Summary:       MySQLi module for PHP
 Summary(pl.UTF-8):     Moduł MySQLi dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mysqli.php
+URL:           http://php.net/manual/en/book.mysqli.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 %{?with_mysqlnd:Requires:      %{name}-mysqlnd = %{epoch}:%{version}-%{release}}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
+Requires:      mysql-libs >= 4.1.13
 Provides:      php(mysqli)
+Obsoletes:     php-mysqli < 4:5.3.28-7
 
 %description mysqli
 This is a dynamic shared object (DSO) for PHP that will add MySQLi
@@ -1096,9 +1096,10 @@ MySQL w wersji 4.1 i nowszych.
 Summary:       MySQL Native Client Driver for PHP
 Summary(pl.UTF-8):     Sterownik natywnego klienta MySQL dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.mysqlnd.php
+URL:           http://php.net/manual/en/book.mysqlnd.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(mysqlnd)
+Obsoletes:     php-mysqlnd < 4:5.3.28-7
 
 %description mysqlnd
 MySQL Native Driver is a replacement for the MySQL Client Library
@@ -1133,10 +1134,12 @@ tym sterowniku - tylko raz.
 Summary:       Oracle 8+ database module for PHP
 Summary(pl.UTF-8):     Moduł bazy danych Oracle 8+ dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.oci8.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+URL:           http://php.net/manual/en/book.oci8.php
+%{?requires_php_extension}
 Provides:      php(oci8)
-AutoReq:       false
+Obsoletes:     php-oci8 < 4:5.3.28-7
+# withdrawn module of similar functionality but different API
+Obsoletes:     php-oracle < 4:5.1.0
 
 %description oci8
 This is a dynamic shared object (DSO) for PHP that will add Oracle 7,
@@ -1151,10 +1154,11 @@ Summary:        ODBC extension module for PHP
 Summary(pl.UTF-8):     Moduł ODBC dla PHP
 Summary(pt_BR.UTF-8):  Um módulo para aplicações PHP que usam bases de dados ODBC
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.uodbc.php
+URL:           http://php.net/manual/en/book.uodbc.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      unixODBC >= 2.1.1-3
 Provides:      php(odbc)
+Obsoletes:     php-odbc < 4:5.3.28-7
 
 %description odbc
 This is a dynamic shared object (DSO) for PHP that will add ODBC
@@ -1168,10 +1172,12 @@ Um módulo para aplicações PHP que usam ODBC.
 
 %package opcache
 Summary:       Zend Optimizer+ - PHP code optimizer
+Summary(pl.UTF-8):     Zend Optimizer+ - optymalizator kodu PHP
 Group:         Libraries
 URL:           https://wiki.php.net/rfc/optimizerplus
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Provides:      php(opcache) = %{opcachever}
+Requires:      %{name}-pcre = %{epoch}:%{version}-%{release}
+Provides:      php(opcache) = %{version}
 
 %description opcache
 The Zend OPcache provides faster PHP execution through opcode caching
@@ -1181,13 +1187,22 @@ reading code from the disk and compiling it on future access. In
 addition, it applies a few bytecode optimization patterns that make
 code execution faster.
 
+%description opcache -l pl.UTF-8
+Zend OPcache zapewnia szybsze wykonywanie kodu PHP dzięki buforowaniu
+i optymalizacji na poziomie opcode'ów. Poprawia wydajność PHP
+przechowując prekompilowany bajtkod skryptu w pamięci współdzielonej.
+Eliminuje etapy odczytu kodu z dysku i kompilacji przy późniejszym
+dostępie. Ponadto wykonuje kilka wzorców optymalizacji bajtkodu,
+czyniąc wykonywanie kodu szybszym.
+
 %package openssl
 Summary:       OpenSSL extension module for PHP
 Summary(pl.UTF-8):     Moduł OpenSSL dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.openssl.php
+URL:           http://php.net/manual/en/book.openssl.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(openssl)
+Obsoletes:     php-openssl < 4:5.3.28-7
 
 %description openssl
 This is a dynamic shared object (DSO) for PHP that will add OpenSSL
@@ -1200,9 +1215,10 @@ Moduł PHP umożliwiający korzystanie z biblioteki OpenSSL.
 Summary:       Process Control extension module for PHP
 Summary(pl.UTF-8):     Moduł Process Control dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.pcntl.php
+URL:           http://php.net/manual/en/book.pcntl.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(pcntl)
+Obsoletes:     php-pcntl < 4:5.3.28-7
 
 %description pcntl
 This is a dynamic shared object (DSO) for PHP that will add process
@@ -1219,6 +1235,7 @@ Summary(pl.UTF-8):        Moduł PCRE dla PHP
 Group:         Libraries
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(pcre)
+Obsoletes:     php-pcre < 4:5.3.28-7
 
 %description pcre
 This is a dynamic shared object (DSO) for PHP that will add Perl
@@ -1232,10 +1249,12 @@ Moduł PHP umożliwiający korzystanie z perlowych wyrażeń regularnych
 Summary:       PHP Data Objects (PDO)
 Summary(pl.UTF-8):     Obsługa PHP Data Objects (PDO)
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.pdo.php
+URL:           http://php.net/manual/en/book.pdo.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
+Provides:      %{name}(PDO_API) = %{php_pdo_api_version}
 Provides:      php(pdo)
+Obsoletes:     php-pdo < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO
 
 %description pdo
@@ -1249,10 +1268,11 @@ Moduł PHP dodający obsługę PDO (PHP Data Objects).
 Summary:       PHP Data Objects (PDO) FreeTDS support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą FreeTDS
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-dblib.php
+URL:           http://php.net/manual/en/ref.pdo-dblib.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
-Provides:      php(dblib)
+Provides:      php(pdo_dblib)
+Obsoletes:     php-pdo-dblib < 4:5.3.28-7
 
 %description pdo-dblib
 This is a dynamic shared object (DSO) for PHP that will add PDO
@@ -1266,10 +1286,12 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) Firebird support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą Firebirda
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-firebird.php
+URL:           http://php.net/manual/en/ref.pdo-firebird.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
 Provides:      php(pdo-firebird)
+Provides:      php(pdo_firebird)
+Obsoletes:     php-pdo-firebird < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_FIREBIRD
 
 %description pdo-firebird
@@ -1284,11 +1306,13 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) MySQL support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą MySQL-a
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-mysql.php
+URL:           http://php.net/manual/en/ref.pdo-mysql.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 %{?with_mysqlnd:Requires:      %{name}-mysqlnd = %{epoch}:%{version}-%{release}}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
 Provides:      php(pdo-mysql)
+Provides:      php(pdo_mysql)
+Obsoletes:     php-pdo-mysql < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_MYSQL
 
 %description pdo-mysql
@@ -1303,10 +1327,12 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) Oracle support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą Oracle'a
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-oci.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
+URL:           http://php.net/manual/en/ref.pdo-oci.php
+%{?requires_php_extension}
+%{?requires_php_pdo_module}
 Provides:      php(pdo-oci)
+Provides:      php(pdo_oci)
+Obsoletes:     php-pdo-oci < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_OCI
 
 %description pdo-oci
@@ -1321,10 +1347,12 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) ODBC support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą ODBC
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-odbc.php
+URL:           http://php.net/manual/en/ref.pdo-odbc.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
 Provides:      php(pdo-odbc)
+Provides:      php(pdo_odbc)
+Obsoletes:     php-pdo-odbc < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_ODBC
 
 %description pdo-odbc
@@ -1339,11 +1367,12 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) PostgreSQL support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą PostgreSQL-a
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-pgsql.php
+URL:           http://php.net/manual/en/ref.pdo-pgsql.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
 Provides:      php(pdo-pgsql)
-Provides:      php-pecl-PDO_PGSQL
+Provides:      php(pdo_pgsql)
+Obsoletes:     php-pdo-pgsql < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_PGSQL < 4:5.2.1-2
 
 %description pdo-pgsql
@@ -1358,10 +1387,12 @@ interfejsu PDO.
 Summary:       PHP Data Objects (PDO) SQLite support
 Summary(pl.UTF-8):     Moduł PHP Data Objects (PDO) z obsługą SQLite
 Group:         Libraries
-URL:           http://www.php.net/manual/en/ref.pdo-sqlite.php
+URL:           http://php.net/manual/en/ref.pdo-sqlite.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pdo = %{epoch}:%{version}-%{release}
 Provides:      php(pdo-sqlite)
+Provides:      php(pdo_sqlite)
+Obsoletes:     php-pdo-sqlite < 4:5.3.28-7
 Obsoletes:     php-pecl-PDO_SQLITE
 
 %description pdo-sqlite
@@ -1376,9 +1407,10 @@ interfejsu PDO.
 Summary:       PostgreSQL database module for PHP
 Summary(pl.UTF-8):     Moduł bazy danych PostgreSQL dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.pgsql.php
+URL:           http://php.net/manual/en/book.pgsql.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(pgsql)
+Obsoletes:     php-pgsql < 4:5.3.28-7
 
 %description pgsql
 This is a dynamic shared object (DSO) for PHP that will add PostgreSQL
@@ -1391,17 +1423,20 @@ Moduł PHP umożliwiający dostęp do bazy danych PostgreSQL.
 Um módulo para aplicações PHP que usam bancos de dados postgresql.
 
 %package phar
-Summary:       phar database module for PHP
+Summary:       Phar archive module for PHP
 Summary(pl.UTF-8):     Moduł phar dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.phar.php
+URL:           http://php.net/manual/en/book.phar.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Requires:      %{name}-hash = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
+Requires:      alternatives
 Suggests:      %{name}-cli
 # zlib is required by phar program, but as phar cli is optional should the dep be too
 Suggests:      %{name}-zlib
 Provides:      php(phar) = %{pharver}
 Obsoletes:     php-pecl-phar < %{pharver}
+Obsoletes:     php-phar < 4:5.3.28-7
 Conflicts:     php-ioncube < 4.0.9
 
 %description phar
@@ -1415,9 +1450,10 @@ Moduł PHP umożliwiający dostęp do achiwów .phar.
 Summary:       POSIX extension module for PHP
 Summary(pl.UTF-8):     Moduł POSIX dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.posix.php
+URL:           http://php.net/manual/en/book.posix.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(posix)
+Obsoletes:     php-posix < 4:5.3.28-7
 
 %description posix
 This is a dynamic shared object (DSO) for PHP that will add POSIX
@@ -1430,9 +1466,10 @@ Moduł PHP umożliwiający korzystanie z funkcji POSIX.
 Summary:       pspell extension module for PHP
 Summary(pl.UTF-8):     Moduł pspell dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.pspell.php
+URL:           http://php.net/manual/en/book.pspell.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(pspell)
+Obsoletes:     php-pspell < 4:5.3.28-7
 
 %description pspell
 This is a dynamic shared object (DSO) for PHP that will add pspell
@@ -1447,9 +1484,10 @@ sprawdzanie pisowni słowa i sugerowanie poprawek.
 Summary:       readline extension module for PHP
 Summary(pl.UTF-8):     Moduł readline dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.readline.php
+URL:           http://php.net/manual/en/book.readline.php
 Requires:      %{name}-cli = %{epoch}:%{version}-%{release}
 Provides:      php(readline)
+Obsoletes:     php-readline < 4:5.3.28-7
 
 %description readline
 This PHP module adds support for readline functions (only for cli and
@@ -1462,10 +1500,11 @@ Moduł PHP dodający obsługę funkcji readline (tylko do SAPI cli i cgi).
 Summary:       recode extension module for PHP
 Summary(pl.UTF-8):     Moduł recode dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.recode.php
+URL:           http://php.net/manual/en/book.recode.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      recode >= 3.5d-3
 Provides:      php(recode)
+Obsoletes:     php-recode < 4:5.3.28-7
 
 %description recode
 This is a dynamic shared object (DSO) for PHP that will add recode
@@ -1482,7 +1521,9 @@ Group:            Libraries
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
 Suggests:      %{name}-hash = %{epoch}:%{version}-%{release}
+Suggests:      tmpwatch
 Provides:      php(session)
+Obsoletes:     php-session < 4:5.3.28-7
 
 %description session
 This is a dynamic shared object (DSO) for PHP that will add session
@@ -1495,9 +1536,10 @@ Moduł PHP dodający obsługę sesji.
 Summary:       Shared Memory Operations extension module for PHP
 Summary(pl.UTF-8):     Moduł shmop dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.shmop.php
+URL:           http://php.net/manual/en/book.shmop.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(shmop)
+Obsoletes:     php-shmop < 4:5.3.28-7
 
 %description shmop
 This is a dynamic shared object (DSO) for PHP that will add Shared
@@ -1510,10 +1552,11 @@ Moduł PHP umożliwiający korzystanie z pamięci dzielonej.
 Summary:       Simple XML extension module for PHP
 Summary(pl.UTF-8):     Moduł prostego rozszerzenia XML dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.simplexml.php
+URL:           http://php.net/manual/en/book.simplexml.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
 Provides:      php(simplexml)
+Obsoletes:     php-simplexml < 4:5.3.28-7
 
 %description simplexml
 This is a dynamic shared object (DSO) for PHP that will add Simple XML
@@ -1526,11 +1569,12 @@ Moduł PHP dodający obsługę prostego XML-a.
 Summary:       SNMP extension module for PHP
 Summary(pl.UTF-8):     Moduł SNMP dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.snmp.php
+URL:           http://php.net/manual/en/book.snmp.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-sockets = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
 Provides:      php(snmp)
+Obsoletes:     php-snmp < 4:5.3.28-7
 
 %description snmp
 This is a dynamic shared object (DSO) for PHP that will add SNMP
@@ -1543,9 +1587,10 @@ Moduł PHP dodający obsługę SNMP.
 Summary:       soap extension module for PHP
 Summary(pl.UTF-8):     Moduł soap dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.soap.php
+URL:           http://php.net/manual/en/book.soap.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(soap)
+Obsoletes:     php-soap < 4:5.3.28-7
 
 %description soap
 This is a dynamic shared object (DSO) for PHP that will add SOAP/WSDL
@@ -1558,9 +1603,10 @@ Moduł PHP dodający obsługę SOAP/WSDL.
 Summary:       sockets extension module for PHP
 Summary(pl.UTF-8):     Moduł socket dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.sockets.php
+URL:           http://php.net/manual/en/book.sockets.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(sockets)
+Obsoletes:     php-sockets < 4:5.3.28-7
 
 %description sockets
 This is a dynamic shared object (DSO) for PHP that will add sockets
@@ -1569,6 +1615,16 @@ support.
 %description sockets -l pl.UTF-8
 Moduł PHP dodający obsługę gniazdek.
 
+%package sodium
+Summary:       Wrapper for the Sodium cryptographic library
+Group:         Libraries
+URL:           https://paragonie.com/book/pecl-libsodium
+Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+Provides:      php(sodium) = %{sodiumver}
+
+%description sodium
+A simple, low-level PHP extension for libsodium.
+
 %package spl
 Summary:       Standard PHP Library module for PHP
 Summary(pl.UTF-8):     Moduł biblioteki standardowej (Standard PHP Library) dla PHP
@@ -1578,6 +1634,7 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-pcre = %{epoch}:%{version}-%{release}
 Requires:      %{name}-simplexml = %{epoch}:%{version}-%{release}
 Provides:      php(spl)
+Obsoletes:     php-spl < 4:5.3.28-7
 
 %description spl
 This is a dynamic shared object (DSO) for PHP that will add Standard
@@ -1593,6 +1650,7 @@ Group:            Libraries
 URL:           http://php.net/manual/en/book.sqlite3.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(sqlite3) = %{sqlite3ver}
+Obsoletes:     php-sqlite3 < 4:5.3.28-7
 
 %description sqlite3
 SQLite is a C library that implements an embeddable SQL database
@@ -1614,30 +1672,14 @@ baz danych. SQLite sam jest serwerem. Biblioteka SQLite czyta i
 zapisuje dane bezpośrednio z/do plików baz danych znajdujących się na
 dysku.
 
-%package sybase-ct
-Summary:       Sybase-CT extension module for PHP
-Summary(pl.UTF-8):     Moduł Sybase-CT dla PHP
-Group:         Libraries
-URL:           http://www.php.net/manual/en/book.sybase.php
-Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Provides:      php(sybase-ct)
-Obsoletes:     php-sybase
-
-%description sybase-ct
-This is a dynamic shared object (DSO) for PHP that will add Sybase and
-MS SQL databases support through CT-lib.
-
-%description sybase-ct -l pl.UTF-8
-Moduł PHP dodający obsługę baz danych Sybase oraz MS SQL poprzez
-CT-lib.
-
 %package sysvmsg
 Summary:       SysV msg extension module for PHP
 Summary(pl.UTF-8):     Moduł SysV msg dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.sem.php
+URL:           http://php.net/manual/en/book.sem.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(sysvmsg)
+Obsoletes:     php-sysvmsg < 4:5.3.28-7
 
 %description sysvmsg
 This is a dynamic shared object (DSO) for PHP that will add SysV
@@ -1650,9 +1692,10 @@ Moduł PHP umożliwiający korzystanie z kolejek komunikatów SysV.
 Summary:       SysV sem extension module for PHP
 Summary(pl.UTF-8):     Moduł SysV sem dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.sem.php
+URL:           http://php.net/manual/en/book.sem.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(sysvsem)
+Obsoletes:     php-sysvsem < 4:5.3.28-7
 
 %description sysvsem
 This is a dynamic shared object (DSO) for PHP that will add SysV
@@ -1665,9 +1708,10 @@ Moduł PHP umożliwiający korzystanie z semaforów SysV.
 Summary:       SysV shm extension module for PHP
 Summary(pl.UTF-8):     Moduł SysV shm dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.shmop.php
+URL:           http://php.net/manual/en/book.sem.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(sysvshm)
+Obsoletes:     php-sysvshm < 4:5.3.28-7
 
 %description sysvshm
 This is a dynamic shared object (DSO) for PHP that will add SysV
@@ -1693,10 +1737,11 @@ Ten pakiet zawiera pliki testów jednostkowych dla PHP i rozszerzeń.
 Summary:       Tidy extension module for PHP
 Summary(pl.UTF-8):     Moduł Tidy dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.tidy.php
+URL:           http://php.net/manual/en/book.tidy.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      tidy
 Provides:      php(tidy)
+Obsoletes:     php-tidy < 4:5.3.28-7
 
 %description tidy
 This is a dynamic shared object (DSO) for PHP that will add Tidy
@@ -1709,9 +1754,10 @@ Moduł PHP umożliwiający korzystanie z tidy.
 Summary:       tokenizer extension module for PHP
 Summary(pl.UTF-8):     Moduł rozszerzenia tokenizer dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.tokenizer.php
+URL:           http://php.net/manual/en/book.tokenizer.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(tokenizer)
+Obsoletes:     php-tokenizer < 4:5.3.28-7
 
 %description tokenizer
 This is a dynamic shared object (DSO) for PHP that will add tokenizer
@@ -1724,7 +1770,7 @@ Moduł PHP dodający obsługę tokenizera do PHP.
 Summary:       wddx extension module for PHP
 Summary(pl.UTF-8):     Moduł wddx dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.wddx.php
+URL:           http://php.net/manual/en/book.wddx.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 # - wddx doesn't require session as it's disabled at compile time:
 #   if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
@@ -1732,6 +1778,7 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release}
 #Requires:     %{name}-session = %{epoch}:%{version}-%{release}
 Requires:      %{name}-xml = %{epoch}:%{version}-%{release}
 Provides:      php(wddx)
+Obsoletes:     php-wddx < 4:5.3.28-7
 
 %description wddx
 This is a dynamic shared object (DSO) for PHP that will add wddx
@@ -1744,9 +1791,10 @@ Moduł PHP umożliwiający korzystanie z wddx.
 Summary:       XML extension module for PHP
 Summary(pl.UTF-8):     Moduł XML dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.xml.php
+URL:           http://php.net/manual/en/book.xml.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(xml)
+Obsoletes:     php-xml < 4:5.3.28-7
 
 %description xml
 This is a dynamic shared object (DSO) for PHP that will add XML
@@ -1762,10 +1810,11 @@ następnie definiować procedury obsługi dla różnych zdarzeń XML.
 Summary:       XML Reader extension module for PHP
 Summary(pl.UTF-8):     Moduł XML Reader dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.xmlreader.php
+URL:           http://php.net/manual/en/book.xmlreader.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-Suggests:      %{name}-dom = %{epoch}:%{version}-%{release}
+Requires:      %{name}-dom = %{epoch}:%{version}-%{release}
 Provides:      php(xmlreader)
+Obsoletes:     php-xmlreader < 4:5.3.28-7
 
 %description xmlreader
 This is a dynamic shared object (DSO) for PHP that will add XML Reader
@@ -1782,10 +1831,11 @@ zatrzymujący się na każdym węźle po drodze.
 Summary:       xmlrpc extension module for PHP
 Summary(pl.UTF-8):     Moduł xmlrpc dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.xmlrpc.php
+URL:           http://php.net/manual/en/book.xmlrpc.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-xml = %{epoch}:%{version}-%{release}
 Provides:      php(xmlrpc)
+Obsoletes:     php-xmlrpc < 4:5.3.28-7
 
 %description xmlrpc
 This is a dynamic shared object (DSO) for PHP that will add XMLRPC
@@ -1798,10 +1848,11 @@ Moduł PHP dodający obsługę XMLRPC.
 Summary:       Fast, non-cached, forward-only means to write XML data
 Summary(pl.UTF-8):     Szybka, nie cachowana metoda zapisu danych w formacie XML
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.xmlwriter.php
+URL:           http://php.net/manual/en/book.xmlwriter.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(xmlwriter)
 Obsoletes:     php-pecl-xmlwriter
+Obsoletes:     php-xmlwriter < 4:5.3.28-7
 
 %description xmlwriter
 This extension wraps the libxml xmlWriter API. Represents a writer
@@ -1817,12 +1868,13 @@ plików zawierających dane XML.
 Summary:       xsl extension module for PHP
 Summary(pl.UTF-8):     Moduł xsl dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.xsl.php
+URL:           http://php.net/manual/en/book.xsl.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-dom = %{epoch}:%{version}-%{release}
-Requires:      libxslt >= 1.0.18
-# actually not true, functionality is similar, but API differs
+Requires:      libxslt >= 1.1.0
 Provides:      php(xsl)
+Obsoletes:     php-xsl < 4:5.3.28-7
+# actually not true, functionality is similar, but API differs
 Obsoletes:     php-xslt <= 3:4.3.8-1
 
 %description xsl
@@ -1836,11 +1888,12 @@ Moduł PHP dodający nową obsługę XSLT (przy użyciu libxslt).
 Summary:       Zip management extension
 Summary(pl.UTF-8):     Zarządzanie archiwami zip
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.zip.php
+URL:           http://php.net/manual/en/book.zip.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
-%{?with_system_libzip:Requires:        libzip >= 0.10.1-2}
+%{?with_system_libzip:Requires:        libzip >= 1.2.0}
 Provides:      php(zip) = %{zipver}
 Obsoletes:     php-pecl-zip < %{zipver}
+Obsoletes:     php-zip < 4:5.3.28-7
 
 %description zip
 Zip is an extension to create, modify and read zip files.
@@ -1853,9 +1906,10 @@ odczyt archiwów zip.
 Summary:       Zlib extension module for PHP
 Summary(pl.UTF-8):     Moduł zlib dla PHP
 Group:         Libraries
-URL:           http://www.php.net/manual/en/book.zlib.php
+URL:           http://php.net/manual/en/book.zlib.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Provides:      php(zlib)
+Obsoletes:     php-zlib < 4:5.3.28-7
 
 %description zlib
 This is a dynamic shared object (DSO) for PHP that will add zlib
@@ -1866,27 +1920,18 @@ Moduł PHP umożliwiający używanie kompresji zlib.
 
 %prep
 %setup -q -n %{orgname}-%{version}
+cp -p php.ini-production php.ini
 %patch0 -p1
 %patch1 -p1
-%patch2 -p1
 %patch3 -p1
-%patch4 -p1
 %patch5 -p1
-%patch6 -p1
 %patch7 -p1
+%{?with_milter:%patch8 -p1}
 %patch9 -p1
-cp -p php.ini-production php.ini
 %patch10 -p1
-%if %{with type_hints}
-%patch12 -p0
-%endif
 %patch14 -p1
 %patch17 -p1
 %patch18 -p1
-%if %{with system_gd}
-%patch19 -p1
-%endif
-%patch20 -p1
 %patch21 -p1
 %patch22 -p1
 %patch23 -p1
@@ -1897,8 +1942,6 @@ cp -p php.ini-production php.ini
 %patch29 -p1
 %patch31 -p1
 %patch34 -p1
-%patch35 -p1
-%patch36 -p1
 %patch37 -p1
 %patch38 -p1
 %patch39 -p1
@@ -1908,29 +1951,30 @@ cp -p php.ini-production php.ini
 %endif
 %patch43 -p1
 %patch44 -p1
-#%patch45 -p1 # imap annotations. fixme
-#%patch46 -p1 # imap myrights. fixme
 %if %{with suhosin}
 %patch47 -p1
 %endif
 %patch50 -p1
-%patch51 -p1
-%patch52 -p1
+%patch51 -p1 -b .spl-shared
+%patch52 -p1 -b .pcre-shared
 %patch53 -p1
 %undos ext/spl/tests/SplFileInfo_getInode_basic.phpt
 %patch55 -p1
-%patch59 -p1
-%patch60 -p1
-%patch62 -p1
-%patch63 -p1
-%{?with_system_libzip:%patch65 -p1}
+%patch59 -p1 -b .systzdata
 %patch66 -p1
+%patch67 -p1
+%patch70 -p1
+%patch71 -p1
+%patch72 -p1 -b .phar-shared
 
-sed -i -e '/PHP_ADD_LIBRARY_WITH_PATH/s#xmlrpc,#xmlrpc-epi,#' ext/xmlrpc/config.m4
+%{__sed} -i -e '/PHP_ADD_LIBRARY_WITH_PATH/s#xmlrpc,#xmlrpc-epi,#' ext/xmlrpc/config.m4
 
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
 
+# com_dotnet is Win32-only
+%{__rm} -r ext/com_dotnet
+
 # conflict seems to be resolved by recode patches
 %{__rm} ext/recode/config9.m4
 
@@ -1944,11 +1988,12 @@ find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
 #%{__rm} -r ext/dba/libinifile
 #%{__rm} -r ext/gd/libgd
 #%{__rm} -r ext/mbstring/libmbfl
-#%{__rm} -r ext/mbstring/oniguruma
-%{__rm} -r ext/pcre/pcrelib
+%{__rm} -r ext/mbstring/oniguruma
+%{__rm} -r ext/pcre/pcre2lib
 #%{__rm} -r ext/soap/interop
 %{__rm} -r ext/xmlrpc/libxmlrpc
 #%{__rm} -r ext/zip/lib
+%{__rm} ext/date/lib/timezonedb.h
 
 cp -pf Zend/LICENSE{,.Zend}
 install -p %{SOURCE13} dep-tests.sh
@@ -1958,22 +2003,22 @@ sed -i -e 's#-fvisibility=hidden##g' configure*
 
 # disable broken tests
 # says just "Terminated" twice and fails
-mv sapi/cli/tests/022.phpt{,.broken}
+%{__mv} sapi/cli/tests/022.phpt{,.broken}
 
 # really dumb test, executable binary name is .libs/ something when building
 # https://bugs.php.net/bug.php?id=54514
-mv tests/basic/bug54514.phpt{,.disable}
+%{__mv} tests/basic/bug54514.phpt{,.disable}
 
 # breaks whole testsuite unexpectedly:
 # Fatal error: Call to undefined function gzencode() in run-tests.php on line 1714
 # probably broken as zlib is built as shared
-mv ext/soap/tests/server019.phpt{,disable}
+%{__mv} ext/soap/tests/server019.phpt{,disable}
 # Fatal error: Call to undefined function gzcompress() in run-tests.php on line 1728
-mv ext/soap/tests/server020.phpt{,disable}
+%{__mv} ext/soap/tests/server020.phpt{,disable}
 
 # runs out of memory and kills carme vserver
 # PASS Bug #39438 (Fatal error: Out of memory) [Zend/tests/bug39438.phpt]
-mv Zend/tests/bug39438.phpt{,.disable}
+%{__mv} Zend/tests/bug39438.phpt{,.disable}
 
 # php-5.3.3/ext/standard/tests/file/statpage.phpt
 %{__rm} ext/standard/tests/file/statpage.phpt
@@ -1989,16 +2034,37 @@ mv Zend/tests/bug39438.phpt{,.disable}
 %{__rm} -r ext/sqlite3/tests
 %endif
 
+# ----- Manage known as failed test -------
+# affected by systzdata patch
+%{__rm} ext/date/tests/timezone_location_get.phpt
+%{__rm} ext/date/tests/timezone_version_get.phpt
+%{__rm} ext/date/tests/timezone_version_get_basic1.phpt
+# Should be skipped but fails sometime
+%{__rm} ext/standard/tests/file/file_get_contents_error001.phpt
+# fails sometimes
+%{__rm} ext/sockets/tests/mcast_ipv?_recv.phpt
+# causes stack exhausion
+%{__rm} Zend/tests/bug54268.phpt
+%{__rm} Zend/tests/bug68412.phpt
+
+# avoid issues when two builds run simultaneously
+%ifarch %{x8664}
+sed -e 's/64321/64322/' -i ext/openssl/tests/*.phpt
+%endif
+
 # skip XFAILs
 # no point testing stuff that is knowingly broken
-find -name '*.phpt' | xargs grep XFAIL -l | xargs rm -v
+find -name '*.phpt' | xargs grep '^--XFAIL--' -l | xargs rm -v
 
 env \
 %ifarch %{ix86}
-ix86= x8664=:
+ix86= x8664=: \
 %endif
 %ifarch %{x8664}
 ix86=: x8664= \
+%endif
+%ifarch x32
+ix86=: x8664=: \
 %endif
        sh -xe %{_sourcedir}/skip-tests.sh
 
@@ -2021,26 +2087,36 @@ if [ $API != %{zend_extension_api} ]; then
        exit 1
 fi
 
+API=$(awk '/#define PDO_DRIVER_API/{print $3}' ext/pdo/php_pdo_driver.h)
+if [ $API != %{php_pdo_api_version} ]; then
+       echo "Set %%define php_pdo_api_version to $API and re-run."
+       exit 1
+fi
+
 # Check for some extension version
-ver=$(sed -n '/#define PHP_FILEINFO_VERSION /{s/.* "//;s/".*$//;p}' ext/fileinfo/php_fileinfo.h)
-if test "$ver" != "%{fileinfover}"; then
+ver=$(awk '/#define PHP_FILEINFO_VERSION/ {print $3}' ext/fileinfo/php_fileinfo.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream FILEINFO version is now ${ver}, expecting %{fileinfover}.
        : Update the fileinfover macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_PHAR_VERSION /{s/.* "//;s/".*$//;p}' ext/phar/php_phar.h)
-if test "$ver" != "%{pharver}"; then
+ver=$(awk '/#define PHP_PHAR_VERSION/ {print $3}' ext/phar/php_phar.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream PHAR version is now ${ver}, expecting %{pharver}.
        : Update the pharver macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_SQLITE3_VERSION/{s/.* "//;s/".*$//;p}' ext/sqlite3/php_sqlite3.h)
-if test "$ver" != "%{sqlite3ver}"; then
+ver=$(awk '/#define PHP_SQLITE3_VERSION/ {print $3}' ext/sqlite3/php_sqlite3.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream Sqlite3 version is now ${ver}, expecting %{sqlite3ver}.
        : Update the sqlite3ver macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_ZIP_VERSION_STRING /{s/.* "//;s/".*$//;p}' ext/zip/php_zip.h)
+ver=$(awk '/#define PHP_SODIUM_VERSION/ {print $3}' ext/sodium/php_libsodium.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
+       exit 1
+fi
+ver=$(sed -n '/#define PHP_ZIP_VERSION /{s/.* "//;s/".*$//;p}' ext/zip/php_zip.h)
 if test "$ver" != "%{zipver}"; then
        : Error: Upstream ZIP version is now ${ver}, expecting %{zipver}.
        : Update the zipver macro and rebuild.
@@ -2052,32 +2128,30 @@ if test "$ver" != "%{jsonver}"; then
        : Update the jsonver macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_ZENDOPCACHE_VERSION /{s/.* "//;s/".*$//;p}' ext/opcache/ZendAccelerator.h)
-if test "$ver" != "%{opcachever}"; then
-       : Error: Upstream Zend Opcachge version is now ${ver}, expecting %{opcachever}.
-       : Update the opcachever macro and rebuild.
+ver=$(sed -n '/#define PHPDBG_VERSION /{s/.* "//;s/".*$//;p}' sapi/phpdbg/phpdbg.h)
+if test "$ver" != "%{phpdbgver}"; then
+       : Error: Upstream phpdbg version is now ${ver}, expecting %{phpdbgver}.
+       : Update the phpdbgver macro and rebuild.
        exit 1
 fi
-ver=$(sed -rne 's,.*<version>(.+)</version>,\1,p' ext/bz2/package.xml)
-if test "$ver" != "%{bz2ver}"; then
+ver=$(awk '/#define PHP_BZ2_VERSION/ {print $3}' ext/bz2/php_bz2.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream BZIP2 version is now ${ver}, expecting %{bz2ver}.
        : Update the bz2ver macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_ENCHANT_VERSION /{s/.* "//;s/".*$//;p}' ext/enchant/php_enchant.h)
-if test "$ver" != "%{enchantver}"; then
-       : Error: Upstream Enchant version is now ${ver}, expecting %{enchantver}.
-       : Update the enchantver macro and rebuild.
+ver=$(awk '/#define PHP_ENCHANT_VERSION/ {print $3}' ext/enchant/php_enchant.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        exit 1
 fi
-ver=$(awk '/#define PHP_HASH_EXTVER/ {print $3}' ext/hash/php_hash.h | xargs)
-if test "$ver" != "%{hashver}"; then
+ver=$(awk '/#define PHP_HASH_VERSION/ {print $3}' ext/hash/php_hash.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream HASH version is now ${ver}, expecting %{hashver}.
        : Update the hashver macro and rebuild.
        exit 1
 fi
-ver=$(sed -n '/#define PHP_INTL_VERSION /{s/.* "//;s/".*$//;p}' ext/intl/php_intl.h)
-if test "$ver" != "%{intlver}"; then
+ver=$(awk '/#define PHP_INTL_VERSION/ {print $3}' ext/intl/php_intl.h | xargs)
+if test "$ver" != "PHP_VERSION"; then
        : Error: Upstream Intl version is now ${ver}, expecting %{intlver}.
        : Update the intlver macro and rebuild.
        exit 1
@@ -2087,7 +2161,7 @@ export EXTENSION_DIR="%{php_extensiondir}"
 # configure once (for faster debugging purposes)
 if [ ! -f _built-conf ]; then
        # now remove Makefile copies
-       rm -f Makefile.{cgi-fcgi,fpm,cli,apxs1,apxs2,litespeed}
+       rm -f Makefile.{cgi-fcgi,fpm,cli,apxs1,apxs2,litespeed,phpdbg,milter}
        %{__libtoolize}
        %{__aclocal}
        cp -f /usr/share/automake/config.* .
@@ -2098,6 +2172,11 @@ export PROG_SENDMAIL="/usr/lib/sendmail"
 export CPPFLAGS="-DDEBUG_FASTCGI -DHAVE_STRNDUP %{rpmcppflags} \
        -I%{_includedir}/xmlrpc-epi"
 
+# This should be detected by configure and set there,
+# but looks like the build system is hosed on 7.3
+export CXXFLAGS="%{rpmcxxflags} -fPIC -DPIC"
+export CFLAGS="%{rpmcflags} -fPIC -DPIC"
+
 sapis="
 cli
 %if %{with cgi}
@@ -2112,12 +2191,15 @@ fpm
 %if %{with embed}
 embed
 %endif
-%if %{with apache1}
-apxs1
-%endif
 %if %{with apache2}
 apxs2
 %endif
+%if %{with phpdbg}
+phpdbg
+%endif
+%if %{with milter}
+milter
+%endif
 "
 for sapi in $sapis; do
        : SAPI $sapi
@@ -2133,59 +2215,66 @@ for sapi in $sapis; do
                sapi_args='--disable-cgi %{?with_gcov:--enable-gcov}'
        ;;
        fpm)
-               sapi_args='--disable-cli --enable-fpm'
+               sapi_args='--disable-cli --disable-cgi --enable-fpm'
                ;;
        embed)
-               sapi_args='--disable-cli --enable-embed'
+               sapi_args='--disable-cli --disable-cgi --enable-embed'
                ;;
-       apxs1)
-               ver=$(rpm -q --qf '%{V}' apache1-devel)
-               sapi_args="--disable-cli --with-apxs=%{apxs1} --with-apache-version=$ver"
-       ;;
        apxs2)
                ver=$(rpm -q --qf '%{V}' apache-devel)
-               sapi_args="--disable-cli --with-apxs2=%{apxs2} --with-apache-version=$ver"
+               sapi_args="--disable-cli --disable-cgi --with-apxs2=%{apxs2} --with-apache-version=$ver"
        ;;
        litespeed)
-               sapi_args='--with-litespeed'
+               sapi_args='--disable-cli --disable-cgi --with-litespeed'
+       ;;
+       phpdbg)
+               sapi_args='--disable-cli --disable-cgi --enable-phpdbg %{?debug:--enable-phpdbg-debug}'
+       ;;
+       milter)
+               sapi_args='--disable-cli --disable-cgi --with-milter'
        ;;
        esac
 
        %configure \
+       EXTRA_LDFLAGS="%{rpmldflags}" \
+       --program-suffix=%{php_suffix} \
        $sapi_args \
 %if "%{!?configure_cache:0}%{?configure_cache}" == "0"
        --cache-file=config.cache \
 %endif
+       --datadir=%{php_datadir} \
        --with-libdir=%{_lib} \
        --with-config-file-path=%{_sysconfdir} \
        --with-config-file-scan-dir=%{_sysconfdir}/conf.d \
        --with-system-tzdata \
+       %{?with_argon2:--with-password-argon2} \
        --%{!?debug:dis}%{?debug:en}able-debug \
        %{?with_zts:--enable-maintainer-zts} \
        --enable-inline-optimization \
-       --enable-bcmath=shared \
-       --enable-calendar=shared \
-       --enable-ctype=shared \
-       --enable-dba=shared \
-       --enable-dom=shared \
-       --enable-exif=shared \
-       --enable-fileinfo=shared \
-       --enable-ftp=shared \
-       --enable-gd-native-ttf \
+       %{__enable_disable bcmath bcmath shared} \
+       %{__enable_disable calendar calendar shared} \
+       %{__enable_disable ctype ctype shared} \
+       %{__enable_disable dba dba shared} \
+       %{__enable_disable dom dom shared} \
+       %{?with_systemtap:--enable-dtrace} \
+       %{__enable_disable exif exif shared} \
+       %{__enable_disable fileinfo fileinfo shared} \
+       %{__enable_disable ftp ftp shared} \
        %{?with_intl:--enable-intl=shared} \
        --enable-libxml \
-       --enable-mbstring=shared,all \
+       %{__enable_disable mbstring mbstring shared,all} \
+       --with-onig=/usr \
        --enable-mbregex \
-       --enable-pcntl=shared \
-       --enable-pdo=shared \
-       --enable-json=shared \
-       --enable-hash=shared \
+       %{__enable_disable pcntl pcntl shared} \
+       %{__enable_disable pdo pdo shared} \
+       %{__enable_disable json json shared} \
+       %{__enable_disable hash hash shared} \
        --enable-xmlwriter=shared \
 %if %{with fpm}
        --with-fpm-user=http \
        --with-fpm-group=http \
 %endif
-%if %{with mssql} || %{with sybase_ct}
+%if %{with pdo_dblib}
        --with-pdo-dblib=shared \
 %endif
 %if %{with interbase} && %{without interbase_inst}
@@ -2193,16 +2282,16 @@ for sapi in $sapis; do
 %endif
        %{?with_mhash:--with-mhash=yes} \
        --with-mysql-sock=/var/lib/mysql/mysql.sock \
-       --with-pdo-mysql=shared,%{!?with_mysqlnd:/usr}%{?with_mysqlnd:mysqlnd} \
-       %{?with_oci8:--with-pdo-oci=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
+       %{__with_without pdo_mysql pdo-mysql shared,%{!?with_mysqlnd:/usr}%{?with_mysqlnd:mysqlnd}} \
+       %{?with_oci:--with-pdo-oci=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
        %{?with_odbc:--with-pdo-odbc=shared,unixODBC,/usr} \
        %{?with_pgsql:--with-pdo-pgsql=shared} \
        %{?with_pdo_sqlite:--with-pdo-sqlite=shared,/usr} \
-       %{?with_webp:--with-vpx-dir=/usr} \
+       %{?with_webp:--with-webp-dir=/usr} \
        --without-libexpat-dir \
-       --enable-posix=shared \
+       %{__enable_disable posix posix shared} \
        --enable-shared \
-       --enable-session=shared \
+       %{__enable_disable session session shared} \
        --enable-shmop=shared \
        --enable-simplexml=shared \
        --enable-sysvmsg=shared \
@@ -2210,32 +2299,30 @@ for sapi in $sapis; do
        --enable-sysvshm=shared \
        --enable-soap=shared \
        --enable-sockets=shared \
+       %{__with_without sodium sodium shared} \
        --enable-tokenizer=shared \
        %{?with_wddx:--enable-wddx=shared} \
        --enable-xml=shared \
        --enable-xmlreader=shared \
-       --with-bz2=shared \
+       %{__with_without bz2 bz2 shared} \
        %{__with_without curl curl shared} \
        --with-db4 \
-       --with-iconv=shared \
+       %{__with_without iconv iconv shared} \
        %{?with_enchant:--with-enchant=shared,/usr} \
        --with-freetype-dir=shared \
-       --with-gettext=shared \
-       --with-gd=shared%{?with_system_gd:,/usr} \
+       %{__with_without gettext gettext shared} \
+       %{__with_without gd gd shared%{?with_system_gd:,/usr}} \
        --with-gdbm \
-       --with-gmp=shared \
+       %{__with_without gmp gmp shared} \
        %{?with_imap:--with-imap=shared --with-imap-ssl} \
        %{?with_interbase:--with-interbase=shared%{!?with_interbase_inst:,/usr}} \
        --with-jpeg-dir=/usr \
        %{?with_ldap:--with-ldap=shared --with-ldap-sasl} \
-       --with-mcrypt=shared \
        %{?with_mm:--with-mm} \
-       %{?with_mssql:--with-mssql=shared} \
        %{?with_mysqlnd:--enable-mysqlnd=shared} \
-       --with-mysql=shared,%{!?with_mysqlnd:/usr}%{?with_mysqlnd:mysqlnd} \
        %{?with_mysqli:--with-mysqli=shared,%{!?with_mysqlnd:/usr/bin/mysql_config}%{?with_mysqlnd:mysqlnd}} \
-       %{?with_oci8:--with-oci8=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
-       %{?with_opcache:--enable-opcache=shared} \
+       %{?with_oci:--with-oci8=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
+       %{__enable_disable opcache opcache shared} \
        %{?with_openssl:--with-openssl=shared} \
        %{?with_kerberos5:--with-kerberos} \
        --with-tcadb=/usr \
@@ -2246,18 +2333,15 @@ for sapi in $sapis; do
        %{__enable_disable phar phar shared} \
        --with-png-dir=/usr \
        %{?with_pspell:--with-pspell=shared} \
-       --with-readline=shared \
+       %{__with_without readline readline shared} \
        %{?with_recode:--with-recode=shared} \
-       --with-regex=system \
        %{?with_snmp:--with-snmp=shared} \
-       %{?with_sybase_ct:--with-sybase-ct=shared,/usr} \
        %{!?with_pdo_sqlite:--without-pdo-sqlite} \
        %{__with_without sqlite3 sqlite3 shared,/usr} \
-       --with-t1lib=shared \
        %{?with_tidy:--with-tidy=shared} \
        %{?with_odbc:--with-unixODBC=shared,/usr} \
        %{__with_without xmlrpc xmlrpc shared,/usr} \
-       --with-xsl=shared \
+       %{?with_xsl:--with-xsl=shared} \
        --with-zlib=shared \
        --with-zlib-dir=shared,/usr \
        %{?with_system_libzip:--with-libzip} \
@@ -2277,18 +2361,30 @@ sapis=$(%{__sed} -rne 's/^PHP_INSTALLED_SAPIS = (.+)/\1/p' Makefile.* | tr ' ' '
 cp -af php_config.h.cli main/php_config.h
 cp -af Makefile.cli Makefile
 %{__make} libphp_common.la
-%{__make} build-modules
-
-%if %{with apache1}
-%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache/libphp5.la -f Makefile.apxs1
-%endif
+# hack: MYSQLND_SHARED_LIBADD not initialized
+%{__make} build-modules \
+       MYSQLND_SHARED_LIBADD="-lssl -lcrypto"
 
 %if %{with apache2}
-%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache2handler/libphp5.la -f Makefile.apxs2
+%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache2handler/libphp7.la -f Makefile.apxs2
 %endif
 
 %if %{with litespeed}
-%{__make} -f Makefile.litespeed
+%{__make} -f Makefile.litespeed litespeed
+%endif
+
+%if %{with embed}
+%{__make} -f Makefile.embed libphp7.la
+%endif
+
+%if %{with phpdbg}
+# PHP_READLINE_LIBS is empty, so force readline here
+%{__make} -f Makefile.phpdbg phpdbg \
+       PHPDBG_EXTRA_LIBS=-lreadline
+%endif
+
+%if %{with milter}
+%{__make} -f Makefile.milter milter
 %endif
 
 # CGI/FCGI
@@ -2331,7 +2427,7 @@ generate_inifiles() {
                [ "$mod" = "spl" ] && conf="SPL.ini"
                # session needs to be loaded before php-pecl-http, php-pecl-memcache, php-pecl-session_mysql
                [ "$mod" = "session" ] && conf="Session.ini"
-               # mysqlnd needs to be loaded before mysql,mysqli,pdo_mysqli
+               # mysqlnd needs to be loaded before mysqli,pdo_mysqli
                [ "$mod" = "mysqlnd" ] && conf="MySQLND.ini"
                echo "+ $conf"
                cat > conf.d/$conf <<-EOF
@@ -2341,6 +2437,7 @@ generate_inifiles() {
        done
 }
 generate_inifiles
+cp -p %{_sourcedir}/opcache.ini conf.d
 
 # Check that the module inner-dependencies are intact
 PHP=./sapi/cli/php EXTENSION_DIR=modules CONFIG_DIR=conf.d ./dep-tests.sh > dep-tests.log
@@ -2361,6 +2458,7 @@ exit 1
 cat <<'EOF' > run-tests.sh
 #!/bin/sh
 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+export SKIP_ONLINE_TESTS=1
 unset TZ LANG LC_ALL || :
 %{__make} test \
        EXTENSION_DIR=modules \
@@ -2374,7 +2472,8 @@ chmod +x run-tests.sh
 cp -pf php_config.h.cli main/php_config.h
 cp -pf Makefile.cli Makefile
 
-./run-tests.sh -w failed.log -s tests.log
+./run-tests.sh -w failed.log -s tests.log || {
+rc=$?
 
 # collect failed tests into cleanup script used in prep.
 sed -ne '/^FAILED TEST SUMMARY/,/^===/p' tests.log | sed -e '1,/^---/d;/^===/,$d' > tests-failed.log
@@ -2385,6 +2484,8 @@ sed -ne '/^via/d;/\[.*\]/{s/\t*\(.*\) \[\(.*\)\]\(.*\)/# \1\3\nmv \2{,.skip}/p}'
 tty -q || cat tests.log
 
 test ! -s failed.log
+exit $rc
+}
 %endif
 
 %install
@@ -2397,26 +2498,28 @@ install -d $RPM_BUILD_ROOT{%{_libdir}/{php,apache{,1}},%{_sysconfdir}/{apache,cg
 cp -pf php_config.h.cli main/php_config.h
 cp -pf Makefile.cli Makefile
 %{__make} install \
+       phpbuilddir=%{_libdir}/%{name}/build \
        INSTALL_ROOT=$RPM_BUILD_ROOT
 
-# make link relative
-ln -sfn phar.phar $RPM_BUILD_ROOT%{_bindir}/phar
+# version the .phar files
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/phar{,%{php_suffix}}.phar
+%{__mv} $RPM_BUILD_ROOT%{_mandir}/man1/phar{,%{php_suffix}}.1
+# touch for ghost
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/phar
+touch $RPM_BUILD_ROOT%{_bindir}/phar
+touch $RPM_BUILD_ROOT%{_mandir}/man1/phar.1
 
 # version suffix
 v=$(echo %{version} | cut -d. -f1-2)
 
-# install Apache1 DSO module
-%if %{with apache1}
-libtool --mode=install install -p sapi/apache/libphp5.la $RPM_BUILD_ROOT%{_libdir}/apache1
-mv $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5{,-$v}.so
-ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5.so
-%endif
-
 # install Apache2 DSO module
 %if %{with apache2}
-libtool --mode=install install -p sapi/apache2handler/libphp5.la $RPM_BUILD_ROOT%{_libdir}/apache
-mv $RPM_BUILD_ROOT%{_libdir}/apache/libphp5{,-$v}.so
-ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.so
+# versioned libphp
+libtool --mode=install install -p sapi/apache2handler/libphp7.la $RPM_BUILD_ROOT%{_libdir}/apache
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/apache/libphp7.la $RPM_BUILD_ROOT%{_libdir}/apache/libphp%{php_suffix}.la
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/apache/libphp7.so $RPM_BUILD_ROOT%{_libdir}/apache/libphp%{php_suffix}.so
+sed -i -e "s|libphp7|libphp%{php_suffix}|g" $RPM_BUILD_ROOT%{_libdir}/apache/libphp%{php_suffix}.la
+ln -s libphp%{php_suffix}.so $RPM_BUILD_ROOT%{_libdir}/apache/mod_php.so
 %endif
 
 # install litespeed sapi
@@ -2424,7 +2527,30 @@ ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.so
 libtool --mode=install install -p sapi/litespeed/php $RPM_BUILD_ROOT%{_sbindir}/%{name}.litespeed
 %endif
 
+%if %{with phpdbg}
+%{__make} -f Makefile.phpdbg install-phpdbg \
+       INSTALL="libtool --mode=install install -p" \
+       INSTALL_ROOT=$RPM_BUILD_ROOT
+%endif
+
+# touch for ghost
+touch $RPM_BUILD_ROOT%{_bindir}/phpize
+touch $RPM_BUILD_ROOT%{_mandir}/man1/phpize.1
+touch $RPM_BUILD_ROOT%{_bindir}/php-config
+touch $RPM_BUILD_ROOT%{_mandir}/man1/php-config.1
+
+%if %{with milter}
+%{__make} -f Makefile.milter install-milter \
+       INSTALL_ROOT=$RPM_BUILD_ROOT
+%endif
+
+# versioned libphp_common
 libtool --mode=install install -p libphp_common.la $RPM_BUILD_ROOT%{_libdir}
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/libphp_common.la $RPM_BUILD_ROOT%{_libdir}/libphp_common%{php_suffix}.la
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/libphp_common-%{version}.so $RPM_BUILD_ROOT%{_libdir}/libphp_common%{php_suffix}-%{version}.so
+%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/libphp_common.so
+ln -s libphp_common%{php_suffix}-%{version}.so $RPM_BUILD_ROOT%{_libdir}/libphp_common%{php_suffix}.so
+sed -i -e "s|libphp_common|libphp_common%{php_suffix}|g" $RPM_BUILD_ROOT%{_libdir}/libphp_common%{php_suffix}.la
 
 # install CGI/FCGI
 %if %{with cgi}
@@ -2436,59 +2562,48 @@ cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi-fcgi.ini
 
 # install FCGI PM
 %if %{with fpm}
-install -d $RPM_BUILD_ROOT{%{_sysconfdir}/fpm.d,%{_sbindir}}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/php-fpm.d,%{_sbindir}}
 libtool --mode=install install -p sapi/fpm/php-fpm $RPM_BUILD_ROOT%{_sbindir}/%{name}-fpm
 cp -p sapi/fpm/php-fpm.8 $RPM_BUILD_ROOT%{_mandir}/man8/%{name}-fpm.8
 cp -p sapi/fpm/php-fpm.conf $RPM_BUILD_ROOT%{_sysconfdir}
+cp -p sapi/fpm/www.conf $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d
 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
 install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fpm
 install -d $RPM_BUILD_ROOT/etc/logrotate.d
 cp -p %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-fpm
 
+# touch for ghost for alternatives
+touch $RPM_BUILD_ROOT%{_sbindir}/php-fpm
+
 %{__sed} -i -e '
        s#/usr/lib/php#%{php_extensiondir}#
-       s#/etc/php#%{_sysconfdir}#
+       s#/etc/php/#%{_sysconfdir}/#
        s#@processname@#%{name}-fpm#g
-' $RPM_BUILD_ROOT{/etc/{rc.d/init.d/%{name}-fpm,logrotate.d/%{name}-fpm},%{_sysconfdir}/php-fpm.conf}
+' $RPM_BUILD_ROOT{/etc/{rc.d/init.d/%{name}-fpm,logrotate.d/%{name}-fpm},%{_sysconfdir}/php-fpm.conf,%{_sysconfdir}/php-fpm.d/www.conf}
 %endif
 
 # install Embedded API
 %if %{with embed}
-%{__make} -f Makefile.embed install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
 # we could use install-headers from Makefile.embed, but that would reinstall all headers
-install -d $RPM_BUILD_ROOT%{_includedir}/php/sapi/embed
-cp -p sapi/embed/php_embed.h $RPM_BUILD_ROOT%{_includedir}/php/sapi/embed
+# install-sapi installs to wrong dir, so just do it all manually
+install -d $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/sapi/embed
+install -p libs/libphp7.so $RPM_BUILD_ROOT%{_libdir}/libphp%{php_suffix}.so
+cp -p sapi/embed/php_embed.h $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/sapi/embed
 %endif
 
-# install CLI
-# versioned suffix is always installed
-libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php%{ver_suffix}
-cp -p sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php%{ver_suffix}.1
-
-%if %{with default_php}
-# man for php
-echo ".so php%{ver_suffix}.1" >$RPM_BUILD_ROOT%{_mandir}/man1/php.1
-# link as /usr/bin/php
-ln -sf php%{ver_suffix} $RPM_BUILD_ROOT%{_bindir}/php
-# php.cli link for backward compatibility
-ln -sf php $RPM_BUILD_ROOT%{_bindir}/php.cli
-%endif
+# CLI
+libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php%{php_suffix}
+# touch for ghost
+touch $RPM_BUILD_ROOT%{_bindir}/php
+touch $RPM_BUILD_ROOT%{_mandir}/man1/php.1
 
 cp -p php.ini $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
-
 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini
-cp -p %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/browscap.ini
-
-%if %{with apache1}
-cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/apache/conf.d/70_mod_php.conf
-cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache.ini
-%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5.la
-%endif
 
 %if %{with apache2}
 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/httpd/conf.d/70_mod_php.conf
 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache2handler.ini
-%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.la
+%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/apache/libphp%{php_suffix}.la
 %endif
 
 # ensure that paths are correct for current php version and arch
@@ -2505,47 +2620,41 @@ cp -p conf.d/*.ini $RPM_BUILD_ROOT%{_sysconfdir}/conf.d
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{cgi-fcgi,cli,apache,apache2handler}.d
 
 # for CLI SAPI only
-mv $RPM_BUILD_ROOT%{_sysconfdir}/{conf.d/readline.ini,cli.d}
+%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/{conf.d/readline.ini,cli.d}
 
 # use system automake and {lib,sh}tool
-ln -snf /usr/share/automake/config.{guess,sub} $RPM_BUILD_ROOT%{_libdir}/php/build
-for i in libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4; do
-       ln -snf %{_aclocaldir}/${i} $RPM_BUILD_ROOT%{_libdir}/php/build
+ln -snf /usr/share/automake/config.{guess,sub} $RPM_BUILD_ROOT%{_libdir}/%{name}/build
+ln -snf %{_bindir}/shtool $RPM_BUILD_ROOT%{_libdir}/%{name}/build
+for fn in libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4; do
+       f=%{_aclocaldir}/$fn
+       test -f $f || continue
+       ln -snf $f $RPM_BUILD_ROOT%{_libdir}/%{name}/build
 done
-ln -snf %{_datadir}/libtool/config/ltmain.sh $RPM_BUILD_ROOT%{_libdir}/php/build
-ln -snf %{_bindir}/shtool $RPM_BUILD_ROOT%{_libdir}/php/build
+for fn in ltmain.sh config/ltmain.sh build-aux/ltmain.sh; do
+       f=/usr/share/libtool/$fn
+       test -f $f || continue
+       ln -snf $f $RPM_BUILD_ROOT%{_libdir}/%{name}/build
+       break
+done
+sed -i -e '/^phpdir/ s,/php/build,/%{name}/build,' $RPM_BUILD_ROOT%{_bindir}/phpize%{php_suffix}
 
 # for php-pecl-mailparse
-install -d $RPM_BUILD_ROOT%{_includedir}/php/ext/mbstring
-cp -p ext/mbstring/libmbfl/mbfl/*.h $RPM_BUILD_ROOT%{_includedir}/php/ext/mbstring
+install -d $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/ext/mbstring
+cp -p ext/mbstring/libmbfl/mbfl/*.h $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/ext/mbstring
 
 # tests
-install -d $RPM_BUILD_ROOT%{php_data_dir}/tests/php
-install -p run-tests.php $RPM_BUILD_ROOT%{php_data_dir}/tests/php/run-tests.php
-cp -a tests/* $RPM_BUILD_ROOT%{php_data_dir}/tests/php
+install -d $RPM_BUILD_ROOT%{php_datadir}/tests/php
+install -p run-tests.php $RPM_BUILD_ROOT%{php_datadir}/tests/php/run-tests.php
+cp -a tests/* $RPM_BUILD_ROOT%{php_datadir}/tests/php
 
 # fix install paths, avoid evil rpaths
-sed -i -e "s|^libdir=.*|libdir='%{_libdir}'|" $RPM_BUILD_ROOT%{_libdir}/libphp_common.la
-%if %{with embed}
-# libphp5.la contains our buildroot in dependency_libs
-sed -i -e "/dependency_libs/ s,/[^ ]*/libs/libphp_common.la,%{_libdir}/libphp_common.la," $RPM_BUILD_ROOT%{_libdir}/libphp5.la
-%endif
+sed -i -e "s|^libdir=.*|libdir='%{_libdir}'|" $RPM_BUILD_ROOT%{_libdir}/libphp_common%{php_suffix}.la
 # better solution?
-sed -i -e 's|libphp_common.la|$(libdir)/libphp_common.la|' $RPM_BUILD_ROOT%{_libdir}/php/build/acinclude.m4
+sed -i -e 's|libphp_common.la|$(libdir)/libphp_common%{php_suffix}.la|' $RPM_BUILD_ROOT%{_libdir}/%{name}/build/acinclude.m4
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post -n apache1-mod_%{name}
-if [ "$1" = "1" ]; then
-       %service -q apache restart
-fi
-
-%postun -n apache1-mod_%{name}
-if [ "$1" = "0" ]; then
-       %service -q apache restart
-fi
-
 %post -n apache-mod_%{name}
 if [ "$1" = "1" ]; then
        %service -q httpd restart
@@ -2556,17 +2665,46 @@ if [ "$1" = "0" ]; then
        %service -q httpd restart
 fi
 
+%post cli
+update-alternatives \
+       --install %{_bindir}/php php %{_bindir}/php%{php_suffix} %{php_suffix} \
+       --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || :
+
+%postun cli
+if [ $1 -eq 0 ]; then
+       update-alternatives --remove php %{_bindir}/php%{php_suffix} || :
+fi
+
+%post  common -p /sbin/ldconfig
+%postun        common -p /sbin/ldconfig
+
+%post devel
+update-alternatives \
+       --install %{_bindir}/phpize phpize %{_bindir}/phpize%{php_suffix} %{php_suffix} \
+       --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || :
+update-alternatives \
+       --install %{_bindir}/php-config php-config %{_bindir}/php-config%{php_suffix} %{php_suffix} \
+       --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || :
+
+%postun devel
+if [ $1 -eq 0 ]; then
+       update-alternatives --remove phpize %{_bindir}/phpize%{php_suffix} || :
+       update-alternatives --remove php-config %{_bindir}/php-config%{php_suffix} || :
+fi
+
 %pre fpm
 %useradd -u 51 -r -s /bin/false -c "HTTP User" -g http http
 
 %post fpm
 /sbin/chkconfig --add %{name}-fpm
 %service %{name}-fpm restart
+update-alternatives --install %{_sbindir}/php-fpm php-fpm %{_sbindir}/php%{php_suffix}-fpm %{php_suffix} || :
 
 %preun fpm
-if [ "$1" = 0 ]; then
+if [ "$1" = "0" ]; then
        %service %{name}-fpm stop
        /sbin/chkconfig --del %{name}-fpm
+       update-alternatives --remove php-fpm %{_sbindir}/php%{php_suffix}-fpm || :
 fi
 
 %postun fpm
@@ -2577,7 +2715,7 @@ fi
 %post  embedded -p /sbin/ldconfig
 %postun        embedded -p /sbin/ldconfig
 
-%post common
+%posttrans common
 # PHP 5.3 requires timezone being setup, try setup it from tzdata
 if ! grep -q '^date.timezone[[:space:]]*=' %{_sysconfdir}/php.ini && [ -f /etc/sysconfig/timezone ]; then
        TIMEZONE=
@@ -2587,7 +2725,6 @@ if ! grep -q '^date.timezone[[:space:]]*=' %{_sysconfdir}/php.ini && [ -f /etc/s
        fi
 fi
 
-%posttrans common
 # minimizing apache restarts logics. we restart webserver:
 #
 # 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
@@ -2601,17 +2738,57 @@ fi
 [ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart
 [ ! -f /etc/httpd/conf.d/??_mod_php.conf ] || %service -q httpd restart
 
+%triggerpostun common -- php-common < 4:5.3.28-7
+# migrate configs /etc/php/conf.d -> /etc/phpXY/conf.d/
+# do config migration in php-common trigger, as the trigger is ran after all packages are upgraded
+# this way we can stick to one trigger, instead of attaching one for each (sub)package!
+for f in /etc/php/*.ini.rpmsave /etc/php/*.d/*.ini.rpmsave; do
+       test -f "$f" || continue
+       bn=${f#/etc/php/}
+       dn=${bn%/*}
+       fn=${bn#*/}
+       test "$dn" = "$fn" && dn=
+       fn=${fn%.rpmsave}
+       nf=%{_sysconfdir}/$dn/$fn
+       test -f "$nf" || continue
+       cp -vfb $nf{,.rpmnew}
+       cp -vfb $f $nf
+       %{__sed} -i -e '
+               s#%{_libdir}/php#%{_libdir}/%{name}#
+               s#/etc/php#%{_sysconfdir}#
+       ' $nf
+done
+
+%triggerpostun common -- %{name}-common < 4:5.6.4-2, php-common < 4:5.6.4-2
+# switch to browscap package if the ini file has original value
+%{__sed} -i -e 's#%{_sysconfdir}/browscap.ini#/usr/share/browscap/php_browscap.ini#' %{_sysconfdir}/php.ini
+# disable browscap, if optional package not present
+if [ ! -e /usr/share/browscap/php_browscap.ini ]; then
+       %{__sed} -i -e 's#^browscap = /usr/share/browscap/php_browscap.ini#;&#' %{_sysconfdir}/php.ini
+fi
+
+%triggerpostun -n apache-mod_%{name} -- apache-mod_%{name} < 4:7.0.0-2.RC4
+sed -i -e 's#modules/libphp[57].so#modules/mod_php.so#g' /etc/httpd/conf.d/*_mod_php.conf
+
 # common macros called at extension post/postun scriptlet
-%define        extension_scripts() \
-%post %1 \
+%define ext_post \
 if [ "$1" = "1" ]; then \
        %php_webserver_restart \
 fi \
-\
-%postun %1 \
+%{nil}
+
+%define ext_postun \
 if [ "$1" = "0" ]; then \
        %php_webserver_restart \
-fi
+fi \
+%{nil}
+
+%define extension_scripts() \
+%post %1 \
+%ext_post \
+\
+%postun %1 \
+%ext_postun \
 %{nil}
 
 # extension scripts defines
@@ -2638,9 +2815,6 @@ fi
 %extension_scripts json
 %extension_scripts ldap
 %extension_scripts mbstring
-%extension_scripts mcrypt
-%extension_scripts mssql
-%extension_scripts mysql
 %extension_scripts mysqli
 %extension_scripts mysqlnd
 %extension_scripts oci8
@@ -2657,7 +2831,6 @@ fi
 %extension_scripts pdo-pgsql
 %extension_scripts pdo-sqlite
 %extension_scripts pgsql
-%extension_scripts phar
 %extension_scripts pcntl
 %extension_scripts posix
 %extension_scripts pspell
@@ -2668,9 +2841,9 @@ fi
 %extension_scripts snmp
 %extension_scripts soap
 %extension_scripts sockets
+%extension_scripts sodium
 %extension_scripts spl
 %extension_scripts sqlite3
-%extension_scripts sybase-ct
 %extension_scripts sysvmsg
 %extension_scripts sysvsem
 %extension_scripts sysvshm
@@ -2685,15 +2858,17 @@ fi
 %extension_scripts zip
 %extension_scripts zlib
 
-%if %{with apache1}
-%files -n apache1-mod_%{name}
-%defattr(644,root,root,755)
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/apache/conf.d/*_mod_php.conf
-%dir %{_sysconfdir}/apache.d
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-apache.ini
-%attr(755,root,root) %{_libdir}/apache1/libphp5.so
-%attr(755,root,root) %{_libdir}/apache1/libphp5-*.*.so
-%endif
+%post phar
+%ext_post
+update-alternatives \
+       --install %{_bindir}/phar phar %{_bindir}/phar%{php_suffix}.phar %{php_suffix} \
+       --slave %{_mandir}/man1/phar.1 phar.1 %{_mandir}/man1/phar%{php_suffix}.1* || :
+
+%postun phar
+%ext_postun
+if [ $1 -eq 0 ]; then
+       update-alternatives --remove phar %{_bindir}/phar%{php_suffix}.phar || :
+fi
 
 %if %{with apache2}
 %files -n apache-mod_%{name}
@@ -2701,8 +2876,8 @@ fi
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/httpd/conf.d/*_mod_php.conf
 %dir %{_sysconfdir}/apache2handler.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-apache2handler.ini
-%attr(755,root,root) %{_libdir}/apache/libphp5.so
-%attr(755,root,root) %{_libdir}/apache/libphp5-*.*.so
+%attr(755,root,root) %{_libdir}/apache/mod_php.so
+%attr(755,root,root) %{_libdir}/apache/libphp%{php_suffix}.so
 %endif
 
 %if %{with litespeed}
 %if %{with embed}
 %files embedded
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libphp5-%{version}.so
+%attr(755,root,root) %{_libdir}/libphp%{php_suffix}.so
 %endif
 
 %files cli
 %defattr(644,root,root,755)
 %dir %{_sysconfdir}/cli.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-cli.ini
-%attr(755,root,root) %{_bindir}/php%{ver_suffix}
-%{_mandir}/man1/php%{ver_suffix}.1*
-%if %{with default_php}
-%attr(755,root,root) %{_bindir}/php
-%attr(755,root,root) %{_bindir}/php.cli
-%{_mandir}/man1/php.1*
-%endif
+%attr(755,root,root) %{_bindir}/php%{php_suffix}
+%{_mandir}/man1/php%{php_suffix}.1*
+%ghost %{_bindir}/php
+%ghost %{_mandir}/man1/php.1*
 
 %if %{with fpm}
 %files fpm
 %defattr(644,root,root,755)
 %doc sapi/fpm/{CREDITS,LICENSE}
-%dir %{_sysconfdir}/fpm.d
+%dir %{_sysconfdir}/php-fpm.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-fpm.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-fpm.d/www.conf
 %attr(755,root,root) %{_sbindir}/%{name}-fpm
+%ghost %{_sbindir}/php-fpm
 %{_mandir}/man8/%{name}-fpm.8*
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}-fpm
 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fpm
 %endif
 
+%if %{with phpdbg}
+%files phpdbg
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/phpdbg%{php_suffix}
+%{_mandir}/man1/phpdbg%{php_suffix}.1*
+%endif
+
+%if %{with milter}
+%files milter
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/php-milter
+%endif
+
 %files common
 %defattr(644,root,root,755)
-%doc CREDITS EXTENSIONS LICENSE NEWS README.{PHP4-TO-PHP5-THIN-CHANGES,namespaces} UPGRADING* Zend/{LICENSE.Zend,ZEND_CHANGES} php.ini-*
+%doc CREDITS EXTENSIONS LICENSE NEWS UPGRADING* Zend/{LICENSE.Zend,README*} php.ini-*
 %dir %{_sysconfdir}
 %dir %{_sysconfdir}/conf.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php.ini
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/browscap.ini
-%attr(755,root,root) %{_libdir}/libphp_common-*.so
+%attr(755,root,root) %{_libdir}/libphp_common%{php_suffix}-*.so
+%dir %{php_datadir}
 %dir %{php_extensiondir}
 
 %doc ext/session/mod_files.sh
 
 %files devel
 %defattr(644,root,root,755)
-%doc CODING_STANDARDS README.{EXTENSIONS,EXT_SKEL,PARAMETER_PARSING_API,SELF-CONTAINED-EXTENSIONS,STREAMS,SUBMITTING_PATCH,TESTING,TESTING2,UNIX-BUILD-SYSTEM,input_filter}
-%attr(755,root,root) %{_bindir}/phpize
-%attr(755,root,root) %{_bindir}/php-config
-%attr(755,root,root) %{_libdir}/libphp_common.so
-%{_libdir}/libphp_common.la
-%{_includedir}/php
-%{_libdir}/php/build
-%{_mandir}/man1/php-config.1*
-%{_mandir}/man1/phpize.1*
-%if %{with embed}
-# embedded
-%{_libdir}/libphp5.so
-%{_libdir}/libphp5.la
-%endif
-
+%doc CODING_STANDARDS README.{EXT_SKEL,PARAMETER_PARSING_API,SELF-CONTAINED-EXTENSIONS,STREAMS,SUBMITTING_PATCH,TESTING,UNIX-BUILD-SYSTEM,input_filter}
+%attr(755,root,root) %{_bindir}/phpize%{php_suffix}
+%attr(755,root,root) %{_bindir}/php-config%{php_suffix}
+%ghost %{_bindir}/phpize
+%ghost %{_bindir}/php-config
+%attr(755,root,root) %{_libdir}/libphp_common%{php_suffix}.so
+%{_libdir}/libphp_common%{php_suffix}.la
+%{_includedir}/php/php%{php_suffix}
+%{_libdir}/%{name}/build
+%{_mandir}/man1/php-config%{php_suffix}.1*
+%ghost %{_mandir}/man1/php-config.1*
+%{_mandir}/man1/phpize%{php_suffix}.1*
+%ghost %{_mandir}/man1/phpize.1*
+
+%if %{with bcmath}
 %files bcmath
 %defattr(644,root,root,755)
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/bcmath.ini
 %attr(755,root,root) %{php_extensiondir}/bcmath.so
+%endif
 
+%if %{with bz2}
 %files bz2
 %defattr(644,root,root,755)
 %doc ext/bz2/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/bz2.ini
 %attr(755,root,root) %{php_extensiondir}/bz2.so
+%endif
 
+%if %{with calendar}
 %files calendar
 %defattr(644,root,root,755)
 %doc ext/calendar/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/calendar.ini
 %attr(755,root,root) %{php_extensiondir}/calendar.so
+%endif
 
+%if %{with ctype}
 %files ctype
 %defattr(644,root,root,755)
 %doc ext/calendar/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/ctype.ini
 %attr(755,root,root) %{php_extensiondir}/ctype.so
+%endif
 
 %if %{with curl}
 %files curl
 %attr(755,root,root) %{php_extensiondir}/curl.so
 %endif
 
+%if %{with dba}
 %files dba
 %defattr(644,root,root,755)
 %doc ext/dba/{CREDITS,README}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/dba.ini
 %attr(755,root,root) %{php_extensiondir}/dba.so
+%endif
 
+%if %{with dom}
 %files dom
 %defattr(644,root,root,755)
-%doc ext/dom/{CREDITS,TODO}
+%doc ext/dom/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/dom.ini
 %attr(755,root,root) %{php_extensiondir}/dom.so
+%endif
 
 %if %{with enchant}
 %files enchant
 %defattr(644,root,root,755)
-%doc ext/enchant/{CREDITS,docs/examples}
+%doc ext/enchant/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/enchant.ini
 %attr(755,root,root) %{php_extensiondir}/enchant.so
 %endif
 
+%if %{with exif}
 %files exif
 %defattr(644,root,root,755)
 %doc ext/exif/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/exif.ini
 %attr(755,root,root) %{php_extensiondir}/exif.so
+%endif
 
+%if %{with fileinfo}
 %files fileinfo
 %defattr(644,root,root,755)
 %doc ext/fileinfo/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/fileinfo.ini
 %attr(755,root,root) %{php_extensiondir}/fileinfo.so
+%endif
 
 %if %{with filter}
 %files filter
 %defattr(644,root,root,755)
-%doc ext/filter/{CREDITS,docs/*}
+%doc ext/filter/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/filter.ini
 %attr(755,root,root) %{php_extensiondir}/filter.so
 %endif
 
+%if %{with ftp}
 %files ftp
 %defattr(644,root,root,755)
 %doc ext/ftp/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/ftp.ini
 %attr(755,root,root) %{php_extensiondir}/ftp.so
+%endif
 
+%if %{with gd}
 %files gd
 %defattr(644,root,root,755)
 %doc ext/gd/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/gd.ini
 %attr(755,root,root) %{php_extensiondir}/gd.so
+%endif
 
+%if %{with gettext}
 %files gettext
 %defattr(644,root,root,755)
 %doc ext/gettext/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/gettext.ini
 %attr(755,root,root) %{php_extensiondir}/gettext.so
+%endif
 
+%if %{with gmp}
 %files gmp
 %defattr(644,root,root,755)
-%doc ext/gmp/{CREDITS,README,TODO}
+%doc ext/gmp/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/gmp.ini
 %attr(755,root,root) %{php_extensiondir}/gmp.so
+%endif
 
+%if %{with hash}
 %files hash
 %defattr(644,root,root,755)
 %doc ext/hash/{CREDITS,README}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/hash.ini
 %attr(755,root,root) %{php_extensiondir}/hash.so
+%endif
 
+%if %{with iconv}
 %files iconv
 %defattr(644,root,root,755)
 %doc ext/iconv/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/iconv.ini
 %attr(755,root,root) %{php_extensiondir}/iconv.so
+%endif
 
 %if %{with imap}
 %files imap
@@ -2905,16 +3119,18 @@ fi
 %if %{with intl}
 %files intl
 %defattr(644,root,root,755)
-%doc ext/intl/{CREDITS,TODO}
+%doc ext/intl/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/intl.ini
 %attr(755,root,root) %{php_extensiondir}/intl.so
 %endif
 
+%if %{with json}
 %files json
 %defattr(644,root,root,755)
 %doc ext/json/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/json.ini
 %attr(755,root,root) %{php_extensiondir}/json.so
+%endif
 
 %if %{with ldap}
 %files ldap
@@ -2924,36 +3140,18 @@ fi
 %attr(755,root,root) %{php_extensiondir}/ldap.so
 %endif
 
+%if %{with mbstring}
 %files mbstring
 %defattr(644,root,root,755)
-%doc ext/mbstring/{CREDITS,README*}
+%doc ext/mbstring/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mbstring.ini
 %attr(755,root,root) %{php_extensiondir}/mbstring.so
-
-%files mcrypt
-%defattr(644,root,root,755)
-%doc ext/mcrypt/{CREDITS,TODO}
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mcrypt.ini
-%attr(755,root,root) %{php_extensiondir}/mcrypt.so
-
-%if %{with mssql}
-%files mssql
-%defattr(644,root,root,755)
-%doc ext/mssql/CREDITS
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mssql.ini
-%attr(755,root,root) %{php_extensiondir}/mssql.so
 %endif
 
-%files mysql
-%defattr(644,root,root,755)
-%doc ext/mysql/CREDITS
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mysql.ini
-%attr(755,root,root) %{php_extensiondir}/mysql.so
-
 %if %{with mysqli}
 %files mysqli
 %defattr(644,root,root,755)
-%doc ext/mysqli/{CREDITS,TODO}
+%doc ext/mysqli/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/mysqli.ini
 %attr(755,root,root) %{php_extensiondir}/mysqli.so
 %endif
@@ -2966,7 +3164,7 @@ fi
 %attr(755,root,root) %{php_extensiondir}/mysqlnd.so
 %endif
 
-%if %{with oci8}
+%if %{with oci}
 %files oci8
 %defattr(644,root,root,755)
 %doc ext/oci8/{CREDITS,README}
@@ -2998,11 +3196,13 @@ fi
 %attr(755,root,root) %{php_extensiondir}/openssl.so
 %endif
 
+%if %{with pcntl}
 %files pcntl
 %defattr(644,root,root,755)
 %doc ext/pcntl/{CREDITS,README}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/pcntl.ini
 %attr(755,root,root) %{php_extensiondir}/pcntl.so
+%endif
 
 %if %{with pcre}
 %files pcre
@@ -3012,13 +3212,15 @@ fi
 %attr(755,root,root) %{php_extensiondir}/pcre.so
 %endif
 
+%if %{with pdo}
 %files pdo
 %defattr(644,root,root,755)
-%doc ext/pdo/{CREDITS,README,TODO}
+%doc ext/pdo/{CREDITS,README}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/pdo.ini
 %attr(755,root,root) %{php_extensiondir}/pdo.so
+%endif
 
-%if %{with mssql} || %{with sybase_ct}
+%if %{with pdo_dblib}
 %files pdo-dblib
 %defattr(644,root,root,755)
 %doc ext/pdo_dblib/{CREDITS,README}
@@ -3034,13 +3236,15 @@ fi
 %attr(755,root,root) %{php_extensiondir}/pdo_firebird.so
 %endif
 
+%if %{with pdo_mysql}
 %files pdo-mysql
 %defattr(644,root,root,755)
 %doc ext/pdo_mysql/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/pdo_mysql.ini
 %attr(755,root,root) %{php_extensiondir}/pdo_mysql.so
+%endif
 
-%if %{with oci8}
+%if %{with oci}
 %files pdo-oci
 %defattr(644,root,root,755)
 %doc ext/pdo_oci/CREDITS
@@ -3083,18 +3287,23 @@ fi
 %if %{with phar}
 %files phar
 %defattr(644,root,root,755)
-%doc ext/phar/{CREDITS,TODO}
+%doc ext/phar/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/phar.ini
 %attr(755,root,root) %{php_extensiondir}/phar.so
-%attr(755,root,root) %{_bindir}/phar
-%attr(755,root,root) %{_bindir}/phar.phar
+%attr(755,root,root) %{_bindir}/phar%{php_suffix}.phar
+%{_mandir}/man1/phar%{php_suffix}.1*
+%{_mandir}/man1/phar.phar.1*
+%ghost %{_bindir}/phar
+%ghost %{_mandir}/man1/phar.1*
 %endif
 
+%if %{with posix}
 %files posix
 %defattr(644,root,root,755)
 %doc ext/posix/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/posix.ini
 %attr(755,root,root) %{php_extensiondir}/posix.so
+%endif
 
 %if %{with pspell}
 %files pspell
@@ -3104,11 +3313,13 @@ fi
 %attr(755,root,root) %{php_extensiondir}/pspell.so
 %endif
 
+%if %{with readline}
 %files readline
 %defattr(644,root,root,755)
 %doc ext/readline/{CREDITS,README*}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cli.d/readline.ini
 %attr(755,root,root) %{php_extensiondir}/readline.so
+%endif
 
 %if %{with recode}
 %files recode
@@ -3118,12 +3329,14 @@ fi
 %attr(755,root,root) %{php_extensiondir}/recode.so
 %endif
 
+%if %{with session}
 %files session
 %defattr(644,root,root,755)
 %doc ext/session/CREDITS
 %doc ext/session/mod_files.sh
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/Session.ini
 %attr(755,root,root) %{php_extensiondir}/session.so
+%endif
 
 %files shmop
 %defattr(644,root,root,755)
@@ -3147,7 +3360,7 @@ fi
 
 %files soap
 %defattr(644,root,root,755)
-%doc ext/soap/{CREDITS,TODO*}
+%doc ext/soap/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/soap.ini
 %attr(755,root,root) %{php_extensiondir}/soap.so
 
@@ -3157,9 +3370,17 @@ fi
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/sockets.ini
 %attr(755,root,root) %{php_extensiondir}/sockets.so
 
+%if %{with sodium}
+%files sodium
+%defattr(644,root,root,755)
+%doc ext/sodium/{README.md,CREDITS}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/sodium.ini
+%attr(755,root,root) %{php_extensiondir}/sodium.so
+%endif
+
 %files spl
 %defattr(644,root,root,755)
-%doc ext/spl/{CREDITS,README,TODO,examples}
+%doc ext/spl/{CREDITS,README,examples}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/SPL.ini
 %attr(755,root,root) %{php_extensiondir}/spl.so
 
@@ -3171,14 +3392,6 @@ fi
 %attr(755,root,root) %{php_extensiondir}/sqlite3.so
 %endif
 
-%if %{with sybase_ct}
-%files sybase-ct
-%defattr(644,root,root,755)
-%doc ext/sybase_ct/CREDITS
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/sybase_ct.ini
-%attr(755,root,root) %{php_extensiondir}/sybase_ct.so
-%endif
-
 %files sysvmsg
 %defattr(644,root,root,755)
 %doc ext/sysvmsg/CREDITS
@@ -3199,23 +3412,23 @@ fi
 
 %files tests
 %defattr(644,root,root,755)
-%dir %{php_data_dir}/tests
-%dir %{php_data_dir}/tests/php
-%{php_data_dir}/tests/php/basic
-%{php_data_dir}/tests/php/classes
-%{php_data_dir}/tests/php/func
-%{php_data_dir}/tests/php/lang
-%{php_data_dir}/tests/php/output
-%{php_data_dir}/tests/php/run-test
-%{php_data_dir}/tests/php/security
-%{php_data_dir}/tests/php/strings
-%{php_data_dir}/tests/php/quicktester.inc
-%attr(755,root,root) %{php_data_dir}/tests/php/run-tests.php
+%dir %{php_datadir}/tests
+%dir %{php_datadir}/tests/php
+%{php_datadir}/tests/php/basic
+%{php_datadir}/tests/php/classes
+%{php_datadir}/tests/php/func
+%{php_datadir}/tests/php/lang
+%{php_datadir}/tests/php/output
+%{php_datadir}/tests/php/run-test
+%{php_datadir}/tests/php/security
+%{php_datadir}/tests/php/strings
+%{php_datadir}/tests/php/quicktester.inc
+%attr(755,root,root) %{php_datadir}/tests/php/run-tests.php
 
 %if %{with tidy}
 %files tidy
 %defattr(644,root,root,755)
-%doc ext/tidy/{CREDITS,README}
+%doc ext/tidy/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/tidy.ini
 %attr(755,root,root) %{php_extensiondir}/tidy.so
 %endif
@@ -3242,7 +3455,7 @@ fi
 
 %files xmlreader
 %defattr(644,root,root,755)
-%doc ext/xmlreader/{CREDITS,README,TODO,examples}
+%doc ext/xmlreader/{CREDITS,README}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/xmlreader.ini
 %attr(755,root,root) %{php_extensiondir}/xmlreader.so
 
@@ -3256,19 +3469,21 @@ fi
 
 %files xmlwriter
 %defattr(644,root,root,755)
-%doc ext/xmlwriter/{CREDITS,TODO}
+%doc ext/xmlwriter/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/xmlwriter.ini
 %attr(755,root,root) %{php_extensiondir}/xmlwriter.so
 
+%if %{with xsl}
 %files xsl
 %defattr(644,root,root,755)
 %doc ext/xsl/CREDITS
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/xsl.ini
 %attr(755,root,root) %{php_extensiondir}/xsl.so
+%endif
 
 %files zip
 %defattr(644,root,root,755)
-%doc ext/zip/{CREDITS,TODO}
+%doc ext/zip/{CREDITS,examples}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/zip.ini
 %attr(755,root,root) %{php_extensiondir}/zip.so