You are not logged in.
I have been trying to build PHP with ZTS-support following this wiki article:
https://wiki.archlinux.org/title/PHP/pthreads_extension
The build succeeds, but i see several warnings during the build using the buildflag mentioned in the wiki:
configure: WARNING: unrecognized options: --enable-maintainer-zts
Afterwards the resulting php binary reports
> php -i | grep Thread
"Thread Safety => disabled"
ZTS is not available
I did this to be able to install the multithreading extensions pthreads and parallel.
These can't be installed because ZTS is not available.
> pecl install parallel
checking for ZTS... configure: error: parallel requires ZTS, please use PHP with ZTS enabled
ERROR: `/tmp/pear/temp/parallel/configure --with-php-config=/usr/bin/php-config' failed
The wiki article says, that the
--enable-maintainer-zts
flag must be used during building.
PHP documentation says it changed to
--enable-zts
since V8.0.
https://www.php.net/manual/en/pthreads.requirements.php
I tried again with that build option but it won't build
checking whether to load legacy algorithm provider... no
checking whether to enable argon2 password hashing (requires OpenSSL >= 3.2)... yes
checking for openssl >= 1.1.1... yes
checking for RAND_egd in -lcrypto... no
configure: error: Not supported in ZTS mode for now
==> FEHLER: Ein Fehler geschah in build().
Breche ab...
I am a bit lost now.
Any ideas on how to fix this?
Thank you very much!
Last edited by wonderworld (2025-06-30 21:33:19)
Offline
2 things: 1) click the "Report" button on your first post and ask a mod to move your post to "Creating & Modifying Packages" or "AUR Issues, Discussion & PKGBUILD Requests". And 2) post your PKGBUILD.
Offline
The PKGBUILD is the original one from the Arch package.
The only change done is the one suggested in the wiki, I added --enable-maintainer-zts. Build succeeds, but no ZTS available in the binary.
Afterwards I tried with --enable-zts which fails to build as described above.
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgbase=php
pkgname=('php'
'php-cgi'
'php-apache'
'php-fpm'
'php-embed'
'php-phpdbg'
'php-dblib'
'php-enchant'
'php-gd'
'php-sodium'
'php-odbc'
'php-pgsql'
'php-snmp'
'php-sqlite'
'php-tidy'
'php-xsl')
pkgver=8.4.8
pkgrel=1
arch=('x86_64')
license=('PHP-3.01')
url='https://www.php.net/'
makedepends=('apache' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp' 'argon2'
'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2'
'oniguruma')
checkdepends=('procps-ng')
source=("https://php.net/distributions/${pkgbase}-${pkgver}.tar.xz"{,.asc}
'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch')
sha256sums=('aa6a4d330b47eacd83e351658ba8c47747a1e4356456219cfb6d75e7838da091'
'SKIP'
'74d33ad3e9fa2f0aaf6ceeddd59ec78d35e66673db74b1053cc3e6105478ba8a'
'4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e'
'78b8074461cdfc5d4e0ba428a8387f308d60720c8ad35c6176801e5088f02090'
'640dba0d960bfeaae9ad38d2826d3f6b5d6c175a4d3e16664eefff29141faad5'
'52a045005f8b241b54f447c22b5d573f3e994481cfc21c2fc111c4a38df55430')
validpgpkeys=('AFD8691FDAEDF03BDF6E460563F15A9B715376CA'
'9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6'
'0616E93D95AF471243E26761770426E17EBBB3DD')
_interpreter=${pkgver%.*}
# LTO is incompatible with global registers and results in reduced performance:
# https://gitlab.archlinux.org/archlinux/packaging/packages/php/-/merge_requests/3
options=('!lto')
prepare() {
cd "${srcdir}/${pkgbase}-${pkgver}"
patch -p0 -i "${srcdir}/apache.patch"
patch -p0 -i "${srcdir}/php-fpm.patch"
patch -p0 -i "${srcdir}/php.ini.patch"
autoconf
# Disable failing tests
rm tests/output/stream_isatty_*.phpt
rm Zend/tests/arginfo_zpp_mismatch*.phpt
}
build() {
local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
--config-cache \
--prefix=/usr \
--sbindir=/usr/bin \
--sysconfdir=/etc/php \
--localstatedir=/var \
--with-layout=GNU \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--disable-rpath \
--mandir=/usr/share/man \
"
local _phpextensions="\
--enable-bcmath=shared \
--enable-calendar=shared \
--enable-dba=shared \
--enable-exif=shared \
--enable-ftp=shared \
--enable-gd=shared \
--enable-intl=shared \
--enable-mbstring \
--enable-pcntl \
--enable-shmop=shared \
--enable-soap=shared \
--enable-sockets=shared \
--enable-sysvmsg=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--with-bz2=shared \
--with-curl=shared \
--with-enchant=shared \
--with-external-gd \
--with-external-pcre \
--with-ffi=shared \
--with-gdbm \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--with-ldap=shared \
--with-ldap-sasl \
--with-mhash \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-mysqli=shared \
--with-openssl \
--with-openssl-argon2 \
--with-password-argon2 \
--with-pdo-dblib=shared,/usr \
--with-pdo-mysql=shared \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-pgsql=shared \
--with-pdo-sqlite=shared \
--with-pgsql=shared \
--with-readline \
--with-snmp=shared \
--with-sodium=shared \
--with-sqlite3=shared \
--with-tidy=shared \
--with-unixODBC=shared \
--with-xsl=shared \
--with-zip=shared \
--with-zlib \
--enable-maintainer-zts \
"
EXTENSION_DIR=/usr/lib/php/modules
export EXTENSION_DIR
mkdir "${srcdir}/build"
cd "${srcdir}/build"
ln -s "../${pkgbase}-${pkgver}/configure"
./configure ${_phpconfig} \
--enable-cgi \
--enable-fpm \
--with-fpm-systemd \
--with-fpm-acl \
--with-fpm-user=http \
--with-fpm-group=http \
--enable-embed=shared \
${_phpextensions}
make
# apache
# reuse the previous run; this will save us a lot of time
cp -a "${srcdir}/build" "${srcdir}/build-apache"
cd "${srcdir}/build-apache"
./configure ${_phpconfig} \
--with-apxs2 \
${_phpextensions}
make
# phpdbg
cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
cd "${srcdir}/build-phpdbg"
./configure ${_phpconfig} \
--enable-phpdbg \
${_phpextensions}
make
}
check() {
cd "${srcdir}/build"
# Check if sendmail was configured correctly (FS#47600)
sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
export REPORT_EXIT_STATUS=1
export NO_INTERACTION=1
export SKIP_ONLINE_TESTS=1
export SKIP_SLOW_TESTS=1
export TEST_PHP_ARGS="-j$(nproc)"
export TESTS='tests Zend'
make test
}
package_php() {
pkgdesc='A general-purpose scripting language that is especially suited to web development'
depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma')
provides=("php-interpreter=${_interpreter}" "php-intl=${pkgver}")
replaces=('php-intl')
conflicts=('php-intl')
backup=('etc/php/php.ini')
cd "${srcdir}/build"
make -j1 INSTALL_ROOT="${pkgdir}" install-{modules,cli,build,headers,programs,pharcmd}
install -D -m644 "${srcdir}/${pkgbase}-${pkgver}/php.ini-production" "${pkgdir}/etc/php/php.ini"
install -d -m755 "${pkgdir}/etc/php/conf.d/"
# remove static modules
rm -f "${pkgdir}/usr/lib/php/modules/"*.a
# remove modules provided by sub packages
rm -f "${pkgdir}/usr/lib/php/modules/"{enchant,gd,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
}
package_php-cgi() {
pkgdesc='CGI and FCGI SAPI for PHP'
depends=('php')
provides=("php-cgi-interpreter=${_interpreter}")
cd "${srcdir}/build"
make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
}
package_php-apache() {
pkgdesc='Apache SAPI for PHP'
depends=('php' 'apache')
backup=('etc/httpd/conf/extra/php_module.conf')
provides=("php-apache-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build-apache/libs/libphp.so" "${pkgdir}/usr/lib/httpd/modules/libphp.so"
install -D -m644 "${srcdir}/apache.conf" "${pkgdir}/etc/httpd/conf/extra/php_module.conf"
}
package_php-fpm() {
pkgdesc='FastCGI Process Manager for PHP'
depends=('php' 'systemd')
backup=('etc/php/php-fpm.conf' 'etc/php/php-fpm.d/www.conf')
provides=("php-fpm-interpreter=${_interpreter}")
options=('!emptydirs')
cd "${srcdir}/build"
make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
install -D -m644 sapi/fpm/php-fpm.service "${pkgdir}/usr/lib/systemd/system/php-fpm.service"
install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php-fpm.conf"
}
package_php-embed() {
pkgdesc='Embedded PHP SAPI library'
depends=('php')
provides=("php-embed-interpreter=${_interpreter}")
options=('!emptydirs')
cd "${srcdir}/build"
make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
}
package_php-phpdbg() {
pkgdesc='Interactive PHP debugger'
depends=('php')
provides=("php-phpdbg-interpreter=${_interpreter}")
options=('!emptydirs')
cd "${srcdir}/build-phpdbg"
make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
}
package_php-dblib() {
pkgdesc='dblib module for PHP'
depends=('php' 'freetds')
provides=("php-dblib-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/pdo_dblib.so" "${pkgdir}/usr/lib/php/modules/pdo_dblib.so"
}
package_php-enchant() {
pkgdesc='enchant module for PHP'
depends=('php' 'enchant')
provides=("php-enchant-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/enchant.so" "${pkgdir}/usr/lib/php/modules/enchant.so"
}
package_php-gd() {
pkgdesc='gd module for PHP'
depends=('php' 'gd')
provides=("php-gd-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/gd.so" "${pkgdir}/usr/lib/php/modules/gd.so"
}
package_php-sodium() {
pkgdesc='sodium module for PHP'
depends=('php' 'libsodium')
provides=("php-sodium-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/sodium.so" "${pkgdir}/usr/lib/php/modules/sodium.so"
}
package_php-odbc() {
pkgdesc='ODBC modules for PHP'
depends=('php' 'unixodbc')
provides=("php-odbc-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/odbc.so" "${pkgdir}/usr/lib/php/modules/odbc.so"
install -D -m755 "${srcdir}/build/modules/pdo_odbc.so" "${pkgdir}/usr/lib/php/modules/pdo_odbc.so"
}
package_php-pgsql() {
pkgdesc='PostgreSQL modules for PHP'
depends=('php' 'postgresql-libs')
provides=("php-pgsql-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/pgsql.so" "${pkgdir}/usr/lib/php/modules/pgsql.so"
install -D -m755 "${srcdir}/build/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/php/modules/pdo_pgsql.so"
}
package_php-snmp() {
pkgdesc='snmp module for PHP'
depends=('php' 'net-snmp')
provides=("php-snmp-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/snmp.so" "${pkgdir}/usr/lib/php/modules/snmp.so"
}
package_php-sqlite() {
pkgdesc='sqlite module for PHP'
depends=('php' 'sqlite')
provides=("php-sqlite-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/sqlite3.so" "${pkgdir}/usr/lib/php/modules/sqlite3.so"
install -D -m755 "${srcdir}/build/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/php/modules/pdo_sqlite.so"
}
package_php-tidy() {
pkgdesc='tidy module for PHP'
depends=('php' 'tidy')
provides=("php-tidy-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/tidy.so" "${pkgdir}/usr/lib/php/modules/tidy.so"
}
package_php-xsl() {
pkgdesc='xsl module for PHP'
depends=('php' 'libxslt')
provides=("php-xsl-interpreter=${_interpreter}")
install -D -m755 "${srcdir}/build/modules/xsl.so" "${pkgdir}/usr/lib/php/modules/xsl.so"
}
Last edited by wonderworld (2025-07-02 09:34:07)
Offline
Mod note: moving to Creating & Modifying Packages
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I think your change from --enable-maintainer-zts to --enable-zts is correct, as per https://www.php.net/manual/en/pthreads.requirements.php. Can you grep for the error "Not supported in ZTS mode for now" in the (upstream) configuration files from the source files? It looks like enabling ZTS conflicts with another module.
Offline
I can find the string in:
./src/php-8.4.8/configure
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_crypto_RAND_egd=yes
else case e in #(
e) ac_cv_lib_crypto_RAND_egd=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_RAND_egd" >&5
printf "%s\n" "$ac_cv_lib_crypto_RAND_egd" >&6; }
if test "x$ac_cv_lib_crypto_RAND_egd" = xyes
then :
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
printf "%s\n" "#define HAVE_RAND_EGD 1" >>confdefs.h
else case e in #(
e)
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
unset ac_cv_lib_crypto_RAND_egd
;;
esac
fi
if test "x$PHP_SYSTEM_CIPHERS" = xno
then :
else case e in #(
e)
printf "%s\n" "#define USE_OPENSSL_SYSTEM_CIPHERS 1" >>confdefs.h
;;
esac
fi
if test "x$PHP_OPENSSL_LEGACY_PROVIDER" = xno
then :
else case e in #(
e)
printf "%s\n" "#define LOAD_OPENSSL_LEGACY_PROVIDER 1" >>confdefs.h
;;
esac
fi
if test "x$PHP_OPENSSL_ARGON2" = xno
then :
else case e in #(
e)
if test "x$PHP_THREAD_SAFETY" = xyes
then :
as_fn_error $? "Not supported in ZTS mode for now" "$LINENO" 5
fi
And here:
/src/php-8.4.8/ext/openssl/config0.m4
PHP_ARG_WITH([openssl],
[for OpenSSL support],
[AS_HELP_STRING([--with-openssl],
[Include OpenSSL support (requires OpenSSL >= 1.1.1)])])
PHP_ARG_WITH([system-ciphers],
[whether to use system default cipher list instead of hardcoded value],
[AS_HELP_STRING([--with-system-ciphers],
[OPENSSL: Use system default cipher list instead of hardcoded value])],
[no],
[no])
PHP_ARG_WITH([openssl-legacy-provider],
[whether to load legacy algorithm provider],
[AS_HELP_STRING([--with-openssl-legacy-provider],
[OPENSSL: Load legacy algorithm provider in addition to default provider])],
[no],
[no])
PHP_ARG_WITH([openssl-argon2],
[whether to enable argon2 password hashing (requires OpenSSL >= 3.2)],
[AS_HELP_STRING([--with-openssl-argon2],
[OPENSSL: Enable argon2 password hashing])],
[no],
[no])
if test "$PHP_OPENSSL" != "no"; then
PHP_NEW_EXTENSION([openssl],
[openssl.c openssl_pwhash.c xp_ssl.c],
[$ext_shared])
PHP_SUBST([OPENSSL_SHARED_LIBADD])
PHP_SETUP_OPENSSL([OPENSSL_SHARED_LIBADD],
[AC_DEFINE([HAVE_OPENSSL_EXT], [1],
[Define to 1 if the PHP extension 'openssl' is available.])])
PHP_CHECK_LIBRARY([crypto], [RAND_egd],
[AC_DEFINE([HAVE_RAND_EGD], [1],
[Define to 1 if OpenSSL crypto library has the 'RAND_egd' function.])],,
[$OPENSSL_LIBS])
AS_VAR_IF([PHP_SYSTEM_CIPHERS], [no],,
[AC_DEFINE([USE_OPENSSL_SYSTEM_CIPHERS], [1],
[Define to 1 to use system default cipher list instead of the hardcoded
value in OpenSSL.])])
AS_VAR_IF([PHP_OPENSSL_LEGACY_PROVIDER], [no],,
[AC_DEFINE([LOAD_OPENSSL_LEGACY_PROVIDER], [1],
[Define to 1 to load the OpenSSL legacy algorithm provider in addition to
the default provider.])])
AS_VAR_IF([PHP_OPENSSL_ARGON2], [no],, [
AS_VAR_IF([PHP_THREAD_SAFETY], [yes],
[AC_MSG_ERROR([Not supported in ZTS mode for now])])
PHP_CHECK_LIBRARY([crypto], [OSSL_set_max_threads],
[AC_DEFINE([HAVE_OPENSSL_ARGON2], [1],
[Define to 1 to enable OpenSSL argon2 password hashing.])],
[AC_MSG_ERROR([argon2 hashing requires OpenSSL 3.2])],
[$OPENSSL_LIBS])
])
fi
So it might have something to do with OpenSSL maybe?
Last edited by wonderworld (2025-07-02 22:31:28)
Offline
Looks like you'll have to enable argon2 hashing.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
OK, I added the options:
--enable-zts \
--with-openssl \
--with-openssl-argon2 \
"
Sadly the build still fails:
Configuring extensions
checking for io.h... no
checking for strtoll... yes
checking for atoll... yes
checking whether the C compiler accepts -Wno-implicit-fallthrough... yes
checking whether to build with LIBXML support... yes
checking for libxml-2.0 >= 2.9.4... yes
checking for OpenSSL support... yes
checking whether to use system default cipher list instead of hardcoded value... no
checking whether to load legacy algorithm provider... no
checking whether to enable argon2 password hashing (requires OpenSSL >= 3.2)... yes
checking for openssl >= 1.1.1... yes
checking for RAND_egd in -lcrypto... no
configure: error: Not supported in ZTS mode for now
Last edited by wonderworld (2025-07-03 10:29:24)
Offline
We may have it backwards and that argon2 should be DISABLED, not enabled (which should mean it was on by default somehow).
I'm new to debugging autoconf scripts, but I *think* it's doing what it's told: when PHP_OPENSSL_ARGON2=='yes' then 'yes' == 'no' is false, which executes the 3rd argument, which errors because PHP_THREAD_SAFETY=='yes'.
AS_VAR_IF([PHP_OPENSSL_ARGON2], [no],, [
AS_VAR_IF([PHP_THREAD_SAFETY], [yes],
[AC_MSG_ERROR([Not supported in ZTS mode for now])])
...
])
Unless I am screwing this up, this means that ZTS + argon2 + thread safety is not supported.
Edit: OR, it's a bug in ext/openssl/config0.m4 and it should be: "AS_VAR_IF([PHP_OPENSSL_ARGON2], [no], [" i.e. one comma, not two.
Last edited by twelveeighty (2025-07-03 16:03:03)
Offline
if test "x$PHP_OPENSSL_ARGON2" = xno
then :
else case e in #(
e)
if test "x$PHP_THREAD_SAFETY" = xyes
then :
as_fn_error $? "Not supported in ZTS mode for now" "$LINENO" 5
fi
Looked again at ./src/php-8.4.8/configure and now think that argon2 should not be used for zts+ thread safety .
try removing
--with-openssl-argon2 \
--with-password-argon2 \
from the PKGBUILD .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline