%define php_ver 74 %define php_prefix /opt/php%{php_ver} %define _default_patch_fuzz 2 %undefine _missing_build_ids_terminate_build %if 0%{?rhel} >= 7 %define apxs /usr/bin/apxs %else %define apxs /usr/sbin/apxs %endif %bcond_without libgd %bcond_with openssl3 Summary: PHP scripting language for creating dynamic web sites Name: isp-php%{php_ver} Version: 7.4.33 Release: 1%{?dist} License: PHP Group: Development/Languages URL: http://www.php.net/ Source0: http://www.php.net/distributions/php-%{version}.tar.xz Source1: php.conf Source2: php.ini Source3: macros.php Source4: php%{php_ver}.conf Source10: ioncube_loader_lin_7.4.so # Build fixes Patch1: php-7.4.0-httpd.patch Patch2: php-5.3.0-install.patch Patch3: php-5.2.4-norpath.patch Patch4: php-5.3.0-phpize64.patch Patch6: php-5.2.4-embed.patch #Patch8: php-5.4.7-libdb.patch Patch9: php-7.0.7-curl.patch # Fixes for extensions Patch26: php-5.3.3-odbc.patch # Functional changes Patch40: php-5.0.4-dlopen.patch Patch42: php-7.3.3-systzdata-v19.patch # Ignore unsupported "threads" option on password_hash Patch46: php-7.4.20-argon2.patch # drop "Configure command" from phpinfo output # and add build system and provider (from 8.0) Patch47: php-7.4.8-phpinfo.patch # compatibility with OpenSSL 3.0, from 8.1 Patch50: php-7.4.26-openssl3.patch Patch121: php_fpm_stop.patch Patch122: php_fpm_service.patch Patch123: memcache.patch Patch124: krb.patch Patch125: mbstring_onig_cent6.patch Patch126: disable_zts.patch %if 0%{?rhel} < 7 BuildRequires: autoconf2.69 %else BuildRequires: autoconf %endif BuildRequires: wget, tar, gcc BuildRequires: gcc-c++, libxml2-devel, bzip2-devel BuildRequires: curl-devel BuildRequires: gmp-devel BuildRequires: pam-devel, libstdc++-devel, BuildRequires: openssl-devel >= 1.0.1 BuildRequires: pkgconfig(sqlite3) >= 3.7.4 BuildRequires: pkgconfig(zlib) >= 1.2.0.4 BuildRequires: pkgconfig(libedit) BuildRequires: pkgconfig(libsodium) BuildRequires: smtpdaemon libtool BuildRequires: perl %if 0%{?rhel} < 8 %if 0%{?rhel} < 7 BuildRequires: mysqlclient18-devel %else BuildRequires: mysql-devel %endif %else BuildRequires: mariadb-devel %endif BuildRequires: enchant-devel BuildRequires: recode-devel, aspell-devel BuildRequires: libtidy-devel, libxslt-devel BuildRequires: net-snmp-devel, libxml2-devel, unixODBC-devel BuildRequires: postgresql-devel, krb5-devel, cyrus-sasl-devel BuildRequires: openldap-devel, libtool-ltdl-devel BuildRequires: mhash-devel %if 0%{?rhel} < 7 BuildRequires: pkgconfig(icu-i18n) >= 60 BuildRequires: db4-devel BuildRequires: libc-client-devel BuildRequires: devtoolset-3-gcc devtoolset-3-gcc-c++ devtoolset-3-build %else BuildRequires: libicu-devel BuildRequires: libdb-devel BuildRequires: uw-imap-static %endif %if %{with libgd} BuildRequires: pkgconfig(gdlib) >= 2.3.3 %else # Required to build the bundled GD library BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(xpm) BuildRequires: pkgconfig(libwebp) Provides: bundled(gd) = 2.0.35 %endif BuildRequires: openldap-devel, unixODBC-devel BuildRequires: postgresql-devel, patch, ImageMagick-devel BuildRequires: httpd-devel %if 0%{?rhel} >= 7 BuildRequires: systemd-devel BuildRequires: libmemcached-devel BuildRequires: libevent-devel %endif BuildRequires: freetds-devel BuildRequires: oniguruma-devel BuildRequires: re2c BuildRequires: libssh2-devel BuildRequires: bats BuildRequires: libacl-devel %if 0%{?rhel} >= 8 BuildRequires: libzip-devel %else BuildRequires: libzip5-devel %endif %if 0%{?rhel} >= 8 BuildRequires: pkgconfig(libpcre2-8) >= 10.30 %else Provides: bundled(pcre2) = 10.32 %endif Requires: freetds %description PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated webpages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts. %package mod-apache Summary: Apache module Requires: %{name}%{?_isa} = %{version}-%{release} %description mod-apache Apache module %package fpm Summary: Fpm service Requires: %{name}%{?_isa} = %{version}-%{release} %description fpm PHP-fpm service %{version} %package lsapi Summary: LSAPI module Requires: %{name}%{?_isa} = %{version}-%{release} %description lsapi LSAPI module %{version} %prep %setup -q -n php-%{version} %patch2 -p1 -b .httpd #%patch2 -p1 -b .install %patch3 -p1 -b .norpath %patch4 -p1 -b .phpize64 %patch6 -p1 -b .embed #%patch8 -p1 -b .libdb %patch9 -p1 -b .curl #%patch26 -p1 -b .pdoodbc #%patch40 -p1 -b .dlopen %if 0%{?fedora} >= 29 || 0%{?rhel} >= 6 %patch42 -p1 -b .systzdata %endif #%patch46 -p1 -b .argon2 %patch46 -p1 -b .phpinfo %if %{with openssl3} %patch50 -p1 -b .ssl3 %endif %patch121 -p1 -b .fpmstop %patch122 -p1 -b .fpmservice #%patch123 -p1 -b .memcache %patch124 -p1 -b .krb %patch125 -p1 -b .onig # Disable ZTS on high apache version %patch126 -p1 # https://bugs.php.net/63362 - Not needed but installed headers. # Drop some Windows specific headers to avoid installation, # before build to ensure they are really not needed. rm -f TSRM/tsrm_win32.h \ TSRM/tsrm_config.w32.h \ Zend/zend_config.w32.h \ ext/mysqlnd/config-win.h \ ext/standard/winver.h \ main/win32_internal_function_disabled.h \ main/win95nt.h # Fix some bogus permissions find . -name \*.[ch] -exec chmod 644 {} \; chmod 644 README.* # Regenerated bison files # to force, rm Zend/zend_{language,ini}_parser.[ch] if [ ! -f Zend/zend_language_parser.c ]; then scripts/dev/genfiles fi %build %if 0%{?rhel} < 7 export PHP_AUTOCONF=autoconf-2.69 export PHP_AUTOHEADER=autoheader-2.69 . /opt/rh/devtoolset-3/enable export CC=/opt/rh/devtoolset-3/root/usr/bin/gcc export CPP=/opt/rh/devtoolset-3/root/usr/bin/cpp export CXX=/opt/rh/devtoolset-3/root/usr/bin/c++ . /etc/profile.d/modules.sh module load autoconf %endif ./buildconf --force CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign" %if 0%{?rhel} > 7 CFLAGS="$CFLAGS -mshstk" %endif export CFLAGS PREFIX=%{php_prefix} syspref=/usr LDFLAGS="-L%{syspref}/%{_lib}/pgsql -Wl,-rpath=%{syspref}/%{_lib}/pgsql $_LDFLAGS" export LDFLAGS EXTENSION_DIR=%{php_prefix}/lib/php/modules; export EXTENSION_DIR PEAR_INSTALLDIR=%{php_prefix}/share/pear; export PEAR_INSTALLDIR CONFIGURE_COMMON=" --prefix=${PREFIX} \ --cache-file=../config.cache \ --with-config-file-path=${PREFIX}/etc \ --with-config-file-scan-dir=${PREFIX}/etc/php.d \ --disable-debug \ --with-libdir=%{_lib} \ --with-pic \ --disable-rpath \ --with-bz2 \ %if %{with libgd} --with-external-gd \ %else --with-webp \ --with-jpeg \ --with-xpm \ --with-freetype \ %endif --without-gdbm \ --with-gettext \ --with-gmp \ --with-iconv \ --with-openssl \ --with-pcre-regex \ %if 0%{?rhel} > 7 --with-external-pcre \ %endif --with-zlib \ --without-password-argon2 \ --with-layout=GNU \ --enable-exif \ --enable-ftp \ --enable-sockets \ --with-kerberos \ --enable-shmop \ --enable-calendar \ --with-libxml-dir=${syspref} \ --enable-xml \ %if 0%{?fedora} >= 29 || 0%{?rhel} >= 6 --with-system-tzdata \ %endif --enable-pcntl \ --enable-mbregex \ --without-readline \ --with-libedit \ --with-sodium=shared \ --with-db4=${syspref}" CONFIGURE_DISABLED=" --disable-dom \ --disable-json \ --disable-pdo \ --enable-timezonedb=shared \ --disable-xmlreader \ --disable-xmlwriter \ --enable-dba=shared \ --disable-posix" mkdir cgi apache2 fpm lsapi cd cgi mkdir -p ext/memcache/php7 %if 0%{?rhel} == 6 export SASL_LIBS="-lsasl2" export SASL_CFLAGS="" export ONIG_LIBS="`onig-config --libs`" export ONIG_CFLAGS="`onig-config --cflags`" %endif env ../configure \ ${CONFIGURE_COMMON} \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared \ --enable-gd=shared \ --enable-bcmath=shared \ --enable-dba=shared \ --with-xmlrpc=shared \ --with-ldap=shared \ %if 0%{?rhel} >= 7 --with-ldap-sasl \ %endif --with-mysql=shared,${syspref} \ --enable-mysqlnd=shared \ --with-mysqli=shared \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli-sock=/var/lib/mysql/mysql.sock \ --enable-dom=shared \ --with-pgsql=shared,${syspref} \ --with-snmp=shared,${syspref} \ --enable-soap=shared \ --with-xsl=shared,${syspref} \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared,${syspref} \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,${syspref} \ --with-pdo-mysql=shared \ --with-pdo-pgsql=shared,${syspref} \ --with-pdo-sqlite=shared,${syspref} \ --with-pdo-dblib=shared \ --enable-json=shared \ --with-zip=shared \ --with-pspell=shared \ --with-tidy=shared,${syspref} \ --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-posix=shared \ --with-unixODBC=shared,${syspref} \ --with-recode=shared,${syspref} \ --with-imagick=shared,${syspref} \ --with-mhash=shared,${syspref} \ --enable-intl=shared,${syspref} \ %if 0%{?rhel} >= 7 --enable-memcached=shared \ --with-libmemcached-dir=shared,${syspref} \ %endif --with-zlib-dir=shared \ --enable-memcache=shared \ --enable-htscanner=shared,${syspref} \ --enable-timezonedb=shared,${syspref} \ --with-ssh2=shared,${syspref} \ --with-pear make %{?_smp_mflags} cd .. && cd apache2 ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --with-apxs2=%{apxs} \ --disable-cli \ --disable-cgi make %{?_smp_mflags} cd .. && cd fpm ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --enable-fpm \ %if 0%{?rhel} >= 7 --with-fpm-systemd \ %endif --with-fpm-acl \ --disable-cli \ --disable-cgi make %{?_smp_mflags} cd .. && cd lsapi ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --enable-litespeed \ --disable-cli \ --disable-cgi make %{?_smp_mflags} cd .. %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign" export CFLAGS make -C cgi install INSTALL_ROOT=$RPM_BUILD_ROOT make -C fpm install INSTALL_ROOT=$RPM_BUILD_ROOT make -C lsapi install INSTALL_ROOT=$RPM_BUILD_ROOT install -m 755 -d $RPM_BUILD_ROOT/%{php_prefix}/lib/httpd/modules install -m 755 apache2/libs/libphp7.so $RPM_BUILD_ROOT/%{php_prefix}/lib/httpd/modules # apache load install -m 755 -d $RPM_BUILD_ROOT/etc/httpd/php-available.d install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc/httpd/php-available.d # # ZendOptimizer # install -m 755 ZendGuardLoader/ZendGuardLoader.so $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ # install -m 755 ZendGuardLoader/opcache.so $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/zend_opcache.so # # Ioncube install -m 755 %{SOURCE10} $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ioncube_loader_lin_7.4.so ln -sf phar.phar $RPM_BUILD_ROOT/%{php_prefix}/bin/phar # php.ini mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{php_prefix}/etc/php.ini # fpm.conf cp $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf.default $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf sed -i -r '/('"'"'|\[)www('"'"'|\])/Q' $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf grep -qE "include=%{php_prefix}/etc/php-fpm.d/\*.conf" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf || echo "include = %{php_prefix}/etc/php-fpm.d/*.conf" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf grep -qE "include=%{php_prefix}/etc/php-fpm.d/pool.d/\*.conf" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf || echo "include=%{php_prefix}/etc/php-fpm.d/pool.d/*.conf" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf sed -i -r "s/^;(syslog.ident = ).*/\1php-fpm%{php_ver}/" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf sed -i -r "s/^;(error_log = ).*/\1syslog/" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.d mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.d/pool.d # fpm service %if 0%{?rhel} >= 7 install -d -m 755 %{buildroot}%{_unitdir} sed -i -r 's|\$\{prefix\}|%{php_prefix}|g; s|\$\{exec_prefix\}|%{php_prefix}|g' fpm/sapi/fpm/php-fpm.service install -m 644 fpm/sapi/fpm/php-fpm.service %{buildroot}%{_unitdir}/php-fpm%{php_ver}.service %else install -d -m 755 %{buildroot}%{_initrddir} install -p -D -m 0755 fpm/sapi/fpm/init.d.php-fpm %{buildroot}%{_initrddir}/php-fpm%{php_ver} sed -i -r "/### BEGIN/,/### END/s/php-fpm/php-fpm%{php_ver}/g" %{buildroot}%{_initrddir}/php-fpm%{php_ver} %endif # fpm var run install -d -m 755 %{buildroot}%{php_prefix}/var/run mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php.d mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available for ext in $(find $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ -name '*.so' | grep -Evi 'zend|ioncube|opcache.so' | awk -F/ '{print $NF}' | sed 's/\.so$//'); do echo "extension=${ext}.so" > $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/${ext}.ini done echo "zend_extension=%{php_prefix}/lib/php/modules/ioncube_loader_lin_7.4.so" > $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/ioncube.ini #echo "zend_extension=%{php_prefix}/lib/php/modules/zend_opcache.so" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/zendopcache.ini echo "zend_extension=%{php_prefix}/lib/php/modules/opcache.so" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/zendopcache.ini #echo "zend_extension=%{php_prefix}/lib/php/modules/ZendGuardLoader.so" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/zendguardloader.ini rm -rf $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/*.a \ $RPM_BUILD_ROOT/\.channels* \ $RPM_BUILD_ROOT/\.depdb* \ $RPM_BUILD_ROOT/\.filemap \ $RPM_BUILD_ROOT/\.lock \ $RPM_BUILD_ROOT/\.registry %check installdir=%{buildroot} bats -t bats/test.bats %post if [ $1 -eq 1 ]; then if [ -f /etc/sysconfig/clock ]; then TZ=$(cat /etc/sysconfig/clock | sed "s|\"||g" | awk -F= '{print $2}') elif [ -x /usr/bin/timedatectl ]; then TZ=$(/usr/bin/timedatectl | awk '$1 ~ /Timezone:/ {print $2}') test -z "${TZ}" && TZ=$(timedatectl | awk '$0 ~ /Time zone:/ {print $3}') else TZ=UTC fi if grep -qE "^date.timezone\s*=" %{php_prefix}/etc/php.ini ; then sed -i -r "s|^date.timezone\s*=.*|date.timezone = ${TZ}|" %{php_prefix}/etc/php.ini else echo "date.timezone = ${TZ}" >> %{php_prefix}/etc/php.ini fi for ext in dom gd mbstring mysqlnd mysqli pdo pdo_mysql json curl zendopcache intl xmlreader xmlwriter zip ; do case ${ext} in mysqlnd|pdo) extl=10-${ext} ;; *) extl=20-${ext} ;; esac if [ -e %{php_prefix}/etc/mods-available/${ext}.ini ]; then ln -sf ../mods-available/${ext}.ini %{php_prefix}/etc/php.d/${extl}.ini fi done else if [ -f %{php_prefix}/etc/php.d/mysqli.ini ]; then if [ ! -f %{php_prefix}/etc/php.d/10-mysqlnd.ini ] && [ ! -f %{php_prefix}/etc/php.d/mysqlnd.ini ]; then ln -s ../mods-available/mysqlnd.ini %{php_prefix}/etc/php.d/10-mysqlnd.ini fi fi fi %postun if [ $1 -eq 0 ]; then find %{php_prefix}/etc/php.d -type l -delete fi %post fpm %if 0%{?rhel} >= 7 %systemd_post php-fpm%{php_ver}.service if [ $1 -ge 1 ] ; then systemctl try-restart php-fpm%{php_ver}.service >/dev/null 2>&1 || : fi %endif %preun fpm %if 0%{?rhel} >= 7 %systemd_preun php-fpm%{php_ver}.service %endif %postun fpm %if 0%{?rhel} >= 7 %systemd_postun_with_restart php-fpm%{php_ver}.service %endif %files %{php_prefix}/bin/p* %{php_prefix}/lib/php %{php_prefix}/share/man/man1 %{php_prefix}/share/pear %{php_prefix}/include %config(noreplace) %{php_prefix}/etc/php.ini %config(noreplace) %{php_prefix}/etc/pear.conf %config(noreplace) %{php_prefix}/etc/mods-available/*.ini %dir %{php_prefix}/etc/php.d %dir %{php_prefix}/etc/mods-available %files mod-apache %{php_prefix}/lib/httpd/modules/* %config(noreplace) /etc/httpd/php-available.d/php%{php_ver}.conf %files fpm %{php_prefix}/sbin/php-fpm %dir %{php_prefix}/etc/php-fpm.d %dir %{php_prefix}/etc/php-fpm.d/pool.d %dir %{php_prefix}/var/run %{php_prefix}/share/man/man8/php-fpm.8 %{php_prefix}/share/php/fpm/status.html %{php_prefix}/etc/php-fpm.conf.default %{php_prefix}/etc/php-fpm.d/www.conf.default %config(noreplace) %{php_prefix}/etc/php-fpm.conf %if 0%{?rhel} >= 7 %{_unitdir}/php-fpm%{php_ver}.service %else %{_initrddir}/php-fpm%{php_ver} %endif %files lsapi %{php_prefix}/bin/lsphp