update to 7.4.23

added php-fpm [release 7.4.23-1mamba;Mon Aug 30 2021]
This commit is contained in:
Silvan Calarco 2024-01-06 09:58:50 +01:00
parent 8d541a7d4c
commit 501aec6079
3 changed files with 233 additions and 71 deletions

74
php-7.4.23-php-fpm.patch Normal file
View File

@ -0,0 +1,74 @@
--- sapi/fpm/Makefile.frag.orig
+++ sapi/fpm/Makefile.frag
@@ -15,8 +15,8 @@
else \
echo "Installing PHP FPM defconfig: $(INSTALL_ROOT)$(sysconfdir)/" && \
$(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d; \
- $(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default; \
- $(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default; \
+ $(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf; \
+ $(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf; \
fi
@echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man8/"
--- sapi/fpm/php-fpm.conf.in.orig
+++ sapi/fpm/php-fpm.conf.in
@@ -14,14 +14,14 @@
; Pid file
; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
; Default Value: none
-;pid = run/php-fpm.pid
+;pid = /run/php-fpm/php-fpm.pid
; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; into a local file.
; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
; Default Value: log/php-fpm.log
-;error_log = log/php-fpm.log
+error_log = syslog
; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
--- sapi/fpm/www.conf.in.orig
+++ sapi/fpm/www.conf.in
@@ -33,7 +33,7 @@
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
-listen = 127.0.0.1:9000
+listen = /run/php-fpm/php-fpm.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
@@ -45,8 +45,8 @@
; and group can be specified either by name or by their numeric IDs.
; Default Values: user and group are set as the running user
; mode is set to 0660
-;listen.owner = @php_fpm_user@
-;listen.group = @php_fpm_group@
+listen.owner = @php_fpm_user@
+listen.group = @php_fpm_group@
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
@@ -387,7 +387,7 @@
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
-;chdir = /var/www
+;chdir = /srv/http
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
--- sapi/fpm/php-fpm.service.in.orig
+++ sapi/fpm/php-fpm.service.in
@@ -8,7 +8,7 @@
[Service]
Type=@php_fpm_systemd@
-PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
+PIDFile=/run/php-fpm/php-fpm.pid
ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

1
php-fpm.tmpfiles Normal file
View File

@ -0,0 +1 @@
d /run/php-fpm 755 root root

229
php.spec
View File

@ -6,16 +6,17 @@
%define with_hardening_patch 0 %define with_hardening_patch 0
Name: php Name: php
Version: 7.4.15 Version: 7.4.23
Release: 2mamba Release: 1mamba
Summary: The PHP HTML-embedded scripting language Summary: The PHP HTML-embedded scripting language
Group: Applications/Development Group: Applications/Development
Vendor: openmamba Vendor: openmamba
Distribution: openmamba Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.php.net/ URL: https://www.php.net/
Source0: http://it2.php.net/distributions/php-%{version}.tar.xz Source0: http://it2.php.net/distributions/php-%{version}.tar.xz
Source1: php-httpd-conf Source1: php-httpd-conf
Source2: php-fpm.tmpfiles
Patch0: http://www.hardened-php.net/hardening-patch-%{hardeningp_phpver}-%{hardeningp_ver}.patch.gz Patch0: http://www.hardened-php.net/hardening-patch-%{hardeningp_phpver}-%{hardeningp_ver}.patch.gz
Patch1: %{name}-5.0.5-phpbuilddir.patch Patch1: %{name}-5.0.5-phpbuilddir.patch
Patch2: %{name}-5.2.5-phpize_dir.patch Patch2: %{name}-5.2.5-phpize_dir.patch
@ -23,13 +24,18 @@ Patch3: %{name}-5.2.9-db47.patch
Patch4: %{name}-5.2.11-BID_36555.patch Patch4: %{name}-5.2.11-BID_36555.patch
Patch5: %{name}-5.3.13-apache-2.4.patch Patch5: %{name}-5.3.13-apache-2.4.patch
Patch6: php-7.4.6-mariadb-10.4.13.patch Patch6: php-7.4.6-mariadb-10.4.13.patch
Patch7: php-7.4.23-php-fpm.patch
License: PHP License License: PHP License
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
#libdl.so.2()(64bit): /usr/lib64/libdl.so: file not owned by any package
#librt.so.1()(64bit): /usr/lib64/librt.so: file not owned by any package
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: libX11-devel BuildRequires: libX11-devel
BuildRequires: libXau-devel BuildRequires: libXau-devel
BuildRequires: libXdmcp-devel BuildRequires: libXdmcp-devel
BuildRequires: libXpm-devel BuildRequires: libXpm-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: libbrotli-devel BuildRequires: libbrotli-devel
BuildRequires: libbsd-devel BuildRequires: libbsd-devel
BuildRequires: libbzip2-devel BuildRequires: libbzip2-devel
@ -71,6 +77,7 @@ BuildRequires: libsasl2-devel
BuildRequires: libsqlite-devel BuildRequires: libsqlite-devel
BuildRequires: libssh2-devel BuildRequires: libssh2-devel
BuildRequires: libstdc++6-devel BuildRequires: libstdc++6-devel
BuildRequires: libsystemd-devel
BuildRequires: libtiff-devel BuildRequires: libtiff-devel
BuildRequires: libunistring-devel BuildRequires: libunistring-devel
BuildRequires: libwebp-devel BuildRequires: libwebp-devel
@ -113,6 +120,18 @@ Included here is the source for the PHP extensions.
Instead of recompiling the whole PHP binary to add support for, say, Oracle, install this package and use the new self-contained extensions support. Instead of recompiling the whole PHP binary to add support for, say, Oracle, install this package and use the new self-contained extensions support.
For more information, read the file SELF-CONTAINED-EXTENSIONS. For more information, read the file SELF-CONTAINED-EXTENSIONS.
%package fpm
Summary: FastCGI Process Manager for PHP
Group: System/Servers
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: systemd
%description fpm
PHP is an HTML-embeddable scripting language.
PHP offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled script with PHP is fairly simple.
The most common use of PHP coding is probably as a replacement for CGI scripts.
This package contains the FastCGI Process Manager for PHP.
%package imap %package imap
Summary: PHP IMAP extension Summary: PHP IMAP extension
Group: System/Servers Group: System/Servers
@ -143,7 +162,7 @@ Group: System/Servers
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: %{name}-pdo = %{?epoch:%epoch:}%{version}-%{release} Requires: %{name}-pdo = %{?epoch:%epoch:}%{version}-%{release}
%description -n php-mysql %description mysql
PHP is an HTML-embeddable scripting language. PHP is an HTML-embeddable scripting language.
PHP offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled script with PHP is fairly simple. PHP offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled script with PHP is fairly simple.
The most common use of PHP coding is probably as a replacement for CGI scripts. The most common use of PHP coding is probably as a replacement for CGI scripts.
@ -155,7 +174,7 @@ Summary: PHP MySQLi extension
Group: System/Servers Group: System/Servers
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description -n php-mysqli %description mysqli
PHP is an HTML-embeddable scripting language. PHP is an HTML-embeddable scripting language.
PHP offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled script with PHP is fairly simple. PHP offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled script with PHP is fairly simple.
The most common use of PHP coding is probably as a replacement for CGI scripts. The most common use of PHP coding is probably as a replacement for CGI scripts.
@ -278,14 +297,14 @@ This package adds PHP support to the Apache Web Server.
%debug_package %debug_package
%prep %prep
%setup -q %setup -q -D -T
#-D -T :<< _EOF
#:<< _EOF
%if %with_hardening_patch %if %with_hardening_patch
%patch0 -p1 -b .hardening %patch0 -p1 -b .hardening
%endif %endif
%patch1 -p1 -b .phpbuilddir %patch1 -p1 -b .phpbuilddir
#%patch6 -p1 #%patch6 -p1
%patch7 -p0
# phpize dir # phpize dir
sed -i "s|@libdir@\`/build|@libdir@\`/php/build|" scripts/phpize.in sed -i "s|@libdir@\`/build|@libdir@\`/php/build|" scripts/phpize.in
@ -295,24 +314,21 @@ cp Zend/LICENSE Zend/ZEND_LICENSE
cp TSRM/LICENSE TSRM_LICENSE cp TSRM/LICENSE TSRM_LICENSE
#cp ext/gd/libgd/README gd_README #cp ext/gd/libgd/README gd_README
# remove unneded packages
#rm -f HTML_Template_IT-*.tar Net_UserAgent_Detect-*.tar
#popd
%build %build
#:<< _EOF :<< _EOF
EXTENSION_DIR=%{_libdir}/php/extensions; export EXTENSION_DIR
EXTENSION_DIR=%{_libdir}/php/extensions
export EXTENSION_DIR
# Required to set default INCLUDE_PATH with %{_libdir}/php # Required to set default INCLUDE_PATH with %{_libdir}/php
PEAR_INSTALLDIR="%{_libdir}/php"; export PEAR_INSTALLDIR PEAR_INSTALLDIR="%{_libdir}/php"; export PEAR_INSTALLDIR
%configure \
_phpconfig="\
--sysconfdir=%{_sysconfdir}/php \ --sysconfdir=%{_sysconfdir}/php \
--with-libdir=%{_lib} \ --with-libdir=%{_lib} \
--disable-debug \ --disable-debug \
--disable-rpath \ --disable-rpath \
--with-pic \ --with-pic \
--enable-sockets \ --enable-sockets \
--with-apxs2=%{_bindir}/apxs \
--enable-shared \
--with-config-file-path=%{_sysconfdir}/php \ --with-config-file-path=%{_sysconfdir}/php \
--with-config-file-scan-dir=%{_sysconfdir}/php/php.d \ --with-config-file-scan-dir=%{_sysconfdir}/php/php.d \
--with-openssl=shared,%{_prefix} \ --with-openssl=shared,%{_prefix} \
@ -347,18 +363,54 @@ PEAR_INSTALLDIR="%{_libdir}/php"; export PEAR_INSTALLDIR
--enable-intl \ --enable-intl \
--enable-gd \ --enable-gd \
--with-external-gd --with-external-gd
"
# FPM
mkdir build-fpm
cd build-fpm
ln -s ../configure .
%configure \
${_phpconfig} \
--enable-cgi \
--enable-fpm \
--with-fpm-systemd \
--with-fpm-acl \
--with-fpm-user=nobody \
--with-fpm-group=nobody \
--enable-embed=shared
%make %make
cd ..
# Apache
# reuse the previous run; this will save us a lot of time
cp -a build-fpm build-apache
_EOF
cd build-apache
%ifarch arm aarch64
# Trick does not work on arm/aarch64
make clean
%endif
%configure \
${_phpconfig} \
--with-apxs2=%{_bindir}/apxs
%make
cd ..
%install %install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
# fake httpd.conf for apxs make install -C build-fpm INSTALL_ROOT=%{buildroot}/
install -D %{S:1} %{buildroot}%{_sysconfdir}/httpd/httpd.conf
make install INSTALL_ROOT=%{buildroot}/ # Remove installed libphp7.so when no apxr is specified
rm -f %{buildroot}%{_prefix}/lib/libphp%{MAJver}.so
rm -f %{buildroot}%{_sysconfdir}/httpd/httpd.conf* # PHP-fpm systemd files
install -D -m644 build-fpm/sapi/fpm/php-fpm.service %{buildroot}%{_unitdir}/php-fpm.service
install -D -m644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/php-fpm.conf
install -D php.ini-production %{buildroot}%{_sysconfdir}/php/php.ini install -D php.ini-production %{buildroot}%{_sysconfdir}/php/php.ini
sed -i "\ sed -i "\
@ -366,15 +418,6 @@ s|\(extension_dir = \).*|\1%{_libdir}/php/extensions|
s|\(;extension=\)php_\(.*\)dll|\1\2so|g;s|w32api.so|odbc.so|" \ s|\(;extension=\)php_\(.*\)dll|\1\2so|g;s|w32api.so|odbc.so|" \
%{buildroot}%{_sysconfdir}/php/php.ini %{buildroot}%{_sysconfdir}/php/php.ini
# create php.conf file for httpd
install -d %{buildroot}%{_sysconfdir}/httpd/httpd.d
cat > %{buildroot}%{_sysconfdir}/httpd/httpd.d/php.conf << _EOF
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
_EOF
install -m 755 -d %{buildroot}%{_sysconfdir}/php/php.d install -m 755 -d %{buildroot}%{_sysconfdir}/php/php.d
install -m 755 -d %{buildroot}%{_localstatedir}/lib/php install -m 755 -d %{buildroot}%{_localstatedir}/lib/php
install -m 700 -d %{buildroot}%{_localstatedir}/lib/php/session install -m 700 -d %{buildroot}%{_localstatedir}/lib/php/session
@ -392,9 +435,21 @@ EOF
EOF EOF
done done
# workaround # workaround for Phar
ln -sf %{_bindir}/phar.phar %{buildroot}%{_bindir}/phar ln -sf %{_bindir}/phar.phar %{buildroot}%{_bindir}/phar
# Apache
install -d -m755 b%{buildroot}%{_libdir}/apache
install -D -m755 build-apache/libs/libphp7.so %{buildroot}%{_libdir}/apache/libphp%{MAJver}.so
install -d %{buildroot}%{_sysconfdir}/httpd/httpd.d
cat > %{buildroot}%{_sysconfdir}/httpd/httpd.d/php.conf << _EOF
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
_EOF
#
# split out the PDO modules # split out the PDO modules
cat files.pdo_mysql >> files.mysql cat files.pdo_mysql >> files.mysql
cat files.pdo_odbc >> files.odbc cat files.pdo_odbc >> files.odbc
@ -411,6 +466,22 @@ rm -f %{buildroot}/.lock
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
%tmpfiles_create_package php-fpm %{SOURCE2}
:
%preun fpm
%systemd_preun php-fpm
:
%post fpm
%systemd_post php-fpm
:
%postun fpm
%systemd_postun_with_restart php-fpm
:
%post -n apache-mod_php %post -n apache-mod_php
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
# delete PHP type definition in httpd.conf, it is now in httpd.d/php.conf # delete PHP type definition in httpd.conf, it is now in httpd.d/php.conf
@ -423,7 +494,7 @@ if [ $1 -ge 1 ]; then
service httpd condrestart service httpd condrestart
fi fi
exit 0 :
%preun -n apache-mod_php %preun -n apache-mod_php
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
@ -433,7 +504,7 @@ if [ $1 -eq 0 ]; then
sed -i "s|\(DirectoryIndex .*\)index.php\(.*\)|\1\2|" /etc/httpd/httpd.conf sed -i "s|\(DirectoryIndex .*\)index.php\(.*\)|\1\2|" /etc/httpd/httpd.conf
service httpd condrestart service httpd condrestart
fi fi
exit 0 :
%files %files
%defattr(-,root,root) %defattr(-,root,root)
@ -459,7 +530,7 @@ exit 0
%doc LICENSE Zend/ZEND_LICENSE TSRM_LICENSE %doc LICENSE Zend/ZEND_LICENSE TSRM_LICENSE
%doc php.ini-development php.ini-production %doc php.ini-development php.ini-production
%files -n php-devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/php-config %{_bindir}/php-config
%{_bindir}/phpize %{_bindir}/phpize
@ -469,48 +540,64 @@ exit 0
%{_mandir}/man1/phpize.1* %{_mandir}/man1/phpize.1*
%doc CODING_STANDARDS.md EXTENSIONS README.md NEWS %doc CODING_STANDARDS.md EXTENSIONS README.md NEWS
%files fpm
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/php/php-fpm.conf
%dir %{_sysconfdir}/php/php-fpm.d
%config(noreplace) %{_sysconfdir}/php/php-fpm.d/www.conf
%{_sbindir}/php-fpm
%{_tmpfilesdir}/php-fpm.conf
%{_unitdir}/php-fpm.service
%dir %{_datadir}/fpm
%{_datadir}/fpm/status.html
%{_mandir}/man8/php-fpm.8*
%files imap -f files.imap
%defattr(-,root,root)
%files ldap -f files.ldap
%defattr(-,root,root)
%files mysql -f files.mysql
%defattr(-,root,root)
%files mysqli -f files.mysqli
%defattr(-,root,root)
%files odbc -f files.odbc
%defattr(-,root,root)
%files opcache -f files.opcache
%defattr(-,root,root)
%files openssl -f files.openssl
%defattr(-,root,root)
%files pdo -f files.pdo
%defattr(-,root,root)
%files pgsql -f files.pgsql
%defattr(-,root,root)
%files sqlite -f files.sqlite3
%defattr(-,root,root)
%files xsl -f files.xsl
%defattr(-,root,root)
%files zip -f files.zip
%defattr(-,root,root)
%files -n apache-mod_php %files -n apache-mod_php
%defattr(-,root,root) %defattr(-,root,root)
%{_libdir}/apache/libphp7.so %{_libdir}/apache/libphp%{MAJver}.so
%config(noreplace) %{_sysconfdir}/httpd/httpd.d/php.conf %config(noreplace) %{_sysconfdir}/httpd/httpd.d/php.conf
%files -n php-imap -f files.imap
%defattr(-,root,root)
%files -n php-ldap -f files.ldap
%defattr(-,root,root)
%files -n php-mysql -f files.mysql
%defattr(-,root,root)
%files -n php-mysqli -f files.mysqli
%defattr(-,root,root)
%files -n php-odbc -f files.odbc
%defattr(-,root,root)
%files -n php-opcache -f files.opcache
%defattr(-,root,root)
%files -n php-openssl -f files.openssl
%defattr(-,root,root)
%files -n php-pdo -f files.pdo
%defattr(-,root,root)
%files -n php-pgsql -f files.pgsql
%defattr(-,root,root)
%files -n php-sqlite -f files.sqlite3
%defattr(-,root,root)
%files -n php-xsl -f files.xsl
%defattr(-,root,root)
%files -n php-zip -f files.zip
%defattr(-,root,root)
%changelog %changelog
* Mon Aug 30 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 7.4.23-1mamba
- update to 7.4.23
- added php-fpm
* Thu Apr 08 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 7.4.15-2mamba * Thu Apr 08 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 7.4.15-2mamba
- rebuilt with --with-zip=shared to fix ZipArchive support - rebuilt with --with-zip=shared to fix ZipArchive support