%define php_ver 53 %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 %define opcache_ver 7.0.5 Requires: freetds Summary: PHP scripting language for creating dynamic web sites Name: isp-php53 Version: 5.3.29 Release: 1500%{?dist} License: PHP Group: Development/Languages URL: http://www.php.net/ Source0: http://www.php.net/distributions/php-%{version}.tar.bz2 Source1: php.conf Source2: php.ini Source3: macros.php Source4: php%{php_ver}.conf Source10: zendopcache-%{opcache_ver}.tgz Source11: ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz Source12: ioncube_loaders_lin_x86-64.tar.gz Source13: memcached-2.2.0.tgz Source14: memcache-3.0.8.tgz # Build fixes Patch1: php-5.3.3-gnusrc.patch Patch2: php-5.3.0-install.patch Patch3: php-5.2.4-norpath.patch Patch4: php-5.3.0-phpize64.patch Patch5: php-5.2.0-includedir.patch Patch6: php-5.2.4-embed.patch Patch7: php-5.3.0-recode.patch Patch8: php-5.3.3-aconf26x.patch # Fixes for extensions Patch20: php-4.3.11-shutdown.patch Patch26: php-5.3.3-odbc.patch # Functional changes Patch40: php-5.0.4-dlopen.patch Patch41: php-5.3.0-easter.patch Patch42: php-5.3.1-systzdata-v7.patch Patch43: php-5.3.3-getmodinit.patch # Fixes for tests Patch61: php-5.0.4-tests-wddx.patch # Bug fixes Patch106: php-5.3.3-copy.patch Patch110: php-5.3.3-bug66762.patch Patch120: close_stderr.patch Patch121: php_fpm_stop.patch Patch122: php_fpm_service.patch Patch123: php_fpm_status.patch Patch125: fix-bug-78599.patch Patch127: php53-mariadb.patch Patch128: disable_zts.patch %if 0%{?rhel} >= 8 Patch129: openssl_path.patch Patch130: memcache-faulty-inline.patch %endif Patch131: mysql8_unicode.patch Patch132: CVE-2021-21703.php-fpm_5.3.patch Patch133: lsapi_printf.patch BuildRequires: autoconf213 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 BuildRequires: sqlite-devel, zlib-devel, pcre-devel BuildRequires: smtpdaemon, libedit-devel, libtool BuildRequires: perl %if 0%{?rhel} < 8 BuildRequires: mysql-devel %else BuildRequires: mariadb-devel %endif BuildRequires: enchant-devel BuildRequires: libicu-devel, recode-devel, aspell-devel BuildRequires: libtidy-devel, libXpm-devel, libxslt-devel BuildRequires: net-snmp-devel, libxml2-devel, unixODBC-devel BuildRequires: krb5-devel, cyrus-sasl-devel BuildRequires: openldap-devel, libtool-ltdl-devel, libXpm-devel BuildRequires: libjpeg-devel, libpng-devel, freetype-devel, compat-gd2-devel %if 0%{?rhel} < 7 BuildRequires: db4-devel BuildRequires: libc-client-devel %else BuildRequires: libdb-devel BuildRequires: uw-imap-static %endif BuildRequires: openldap-devel, unixODBC-devel BuildRequires: postgresql-devel < 9.2, patch, ImageMagick-devel BuildRequires: libmcrypt-devel BuildRequires: httpd-devel BuildRequires: freetds-devel BuildRequires: libmemcached-devel BuildRequires: libssh2-devel BuildRequires: bats %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. The php package contains the module which adds support for the PHP language to Apache HTTP Server. %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} %patch1 -p1 -b .gnusrc %patch2 -p1 -b .install %patch3 -p1 -b .norpath %patch4 -p1 -b .phpize64 %patch5 -p1 -b .includedir %patch6 -p1 -b .embed %patch7 -p1 -b .recode %patch20 -p1 -b .shutdown %patch26 -p1 -b .pdoodbc %patch40 -p1 -b .dlopen %patch41 -p1 -b .easter %patch42 -p1 -b .systzdata %patch43 -p1 -b .getmodinit %patch61 -p1 -b .tests-wddx %patch106 -p1 -b .copy %patch110 -p0 -b .bug66762 %patch120 -p1 -b .bug69865 %patch121 -p1 -b .fpmstop %patch122 -p1 -b .fpmservice %patch123 -p1 -b .fpmstatus %patch125 -p1 -b .bug78599 %patch127 -p1 -b .mariadb # Disable ZTS on high apache version %patch128 -p1 # Fix openssl10.cnf path %if 0%{?rhel} >= 8 %patch129 -p1 %patch130 -p1 %endif # Fix mysql8 unicode %patch131 -p1 # CVE-2021-21703 php-fpm %patch132 -p1 # lsapi_printf.patch https://bugs.php.net/bug.php?id=63228 %patch133 -p1 pushd ext tar -xf %{SOURCE10} tar -xf %{SOURCE13} tar -xf %{SOURCE14} popd tar -xf %{SOURCE11} tar -xf %{SOURCE12} %build mv ext/zendopcache-%{opcache_ver} ext/opcache mv ext/memcached-2.2.0 ext/memcached mv ext/memcache-3.0.8 ext/memcache export AUTOCONF=autoconf-2.13 export PHP_AUTOCONF=autoconf-2.13 ./buildconf --force CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign" export CFLAGS PREFIX=%{php_prefix} syspref=/usr 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 0%{?rhel} == 6 --with-gd=${syspref} \ %else --with-freetype-dir=${syspref} \ --with-png-dir=${syspref} \ --with-xpm-dir=${syspref} \ --with-jpeg-dir=${syspref} \ %endif --enable-gd-native-ttf \ --without-gdbm \ --with-gettext \ --with-gmp \ --with-iconv \ --with-openssl=${syspref} \ --with-pcre-regex=${syspref} \ --with-zlib \ --with-layout=GNU \ --enable-exif \ --enable-ftp \ --enable-magic-quotes \ --enable-sockets \ --with-kerberos \ --enable-ucd-snmp-hack \ --enable-shmop \ --enable-calendar \ --without-sqlite \ --with-libxml-dir=${syspref} \ --enable-xml \ --with-mhash \ --with-system-tzdata \ --enable-force-cgi-redirect \ --enable-pcntl \ --enable-mbregex \ --without-readline \ --with-libedit \ --with-db4=${syspref} \ --with-phar" CONFIGURE_DISABLED=" --disable-dom \ --disable-json \ --disable-pdo \ --disable-mysqli \ --enable-timezonedb=shared \ --disable-xmlreader \ --disable-xmlwriter \ --enable-dba=shared \ --disable-posix" mkdir cgi apache2 fpm lsapi cd cgi ../configure \ ${CONFIGURE_COMMON} \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared \ --with-gd=shared \ --enable-bcmath=shared \ --enable-dba=shared \ --with-xmlrpc=shared \ --with-ldap=shared --with-ldap-sasl \ --enable-mysqlnd \ --with-mysql=shared \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli-sock=/var/lib/mysql/mysql.sock \ --enable-mysqlnd=shared \ --enable-dom=shared \ --with-pgsql=shared,${syspref} \ --enable-wddx=shared \ --with-snmp=shared,${syspref} \ --enable-soap=shared \ --with-xsl=shared,${syspref} \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared,${syspref} \ --enable-fastcgi \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,${syspref} \ --with-pdo-mysql=shared,${syspref} \ --with-pdo-pgsql=shared,${syspref} \ --with-pdo-sqlite=shared,${syspref} \ --with-pdo-dblib=shared \ --with-sybase-ct=shared,${syspref} \ --enable-json=shared \ --enable-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-db4=${syspref} \ --with-imagick=shared,${syspref} \ --enable-intl=shared,${syspref} \ --enable-htscanner=shared,${syspref} \ --enable-timezonedb=shared,${syspref} \ --with-ssh2=shared,${syspref} \ --enable-memcache=shared \ --enable-memcached=shared \ --with-libmemcached-dir=shared,${syspref} \ --enable-opcache=shared \ --with-mcrypt=shared make %{?_smp_mflags} cd .. && cd apache2 ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --with-apxs2=%{apxs} \ --disable-cli make %{?_smp_mflags} cd .. && cd fpm ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --enable-fpm \ --disable-cli make %{?_smp_mflags} cd .. && cd lsapi ../configure \ ${CONFIGURE_COMMON} \ ${CONFIGURE_DISABLED} \ --with-litespeed \ --disable-cli 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/libphp5.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-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ # Ioncube install -m 755 ioncube/ioncube_loader_lin_5.3.so $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ # 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 echo "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/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' | 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/opcache.so" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/zendopcache.ini echo "zend_extension=%{php_prefix}/lib/php/modules/ioncube_loader_lin_5.3.so" > $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/ioncube.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 mysql mysqlnd mysqli pdo pdo_mysql xml json curl mcrypt soap ssh2 xmlrpc zendopcache intl xmlreader xmlwriter zip ; do case ${ext} in mysql|pdo|mysqlnd) extl=10-${ext} ;; *) extl=20-${ext} ;; esac ln -sf ../mods-available/${ext}.ini %{php_prefix}/etc/php.d/${extl}.ini 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 %exclude %{php_prefix}/share/php/fpm %{php_prefix}/include %{php_prefix}/man/man1 %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 %doc %{php_prefix}/man/man8/php-fpm.8 %{php_prefix}/share/php/fpm/status.html %{php_prefix}/etc/php-fpm.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