Skip to content

[feat] Add gnu based static binary support#592

Merged
crazywhalecc merged 16 commits intomainfrom
feat/gnu-static
Mar 11, 2025
Merged

[feat] Add gnu based static binary support#592
crazywhalecc merged 16 commits intomainfrom
feat/gnu-static

Conversation

@crazywhalecc
Copy link
Owner

@crazywhalecc crazywhalecc commented Jan 28, 2025

What does this PR do?

  • Add gnu based static binary support, fix Optional GNU C Library support #376
  • Add CentOS 7.x doctor command support
  • Add env override file config/env.custom.ini
  • Fix openssl extension sanity check

Basic usage:

# run as CentOS 7 based docker image
bin/spc-gnu-docker --libc=glibc <command> ...

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If it's an extension or dependency update, make sure adding related extensions in src/global/test-extensions.php.
  • If you changed the behavior of static-php-cli, update docs in ./docs/.
  • If you updated config/xxx.json content, run bin/spc dev:sort-config xxx.

@crazywhalecc crazywhalecc added new feature New feature or request os/linux Things only for Linux OS mixed PR This PR contains multiple updates labels Jan 28, 2025
@crazywhalecc crazywhalecc marked this pull request as draft January 28, 2025 11:41
@crazywhalecc crazywhalecc changed the title Add gnu based static binary support [feat] Add gnu based static binary support Jan 28, 2025
@crazywhalecc crazywhalecc marked this pull request as ready for review February 4, 2025 08:19
@crazywhalecc
Copy link
Owner Author

crazywhalecc commented Feb 4, 2025

@dunglas Building some extension combinations with glibc is pretty smooth at the moment, but I'm not sure there are any hidden issues I haven't discovered yet. Docs are also in this PR.

It would be great if you'd like to provide some suggestions or feedback, and I'll merge to the main branch later.

@dunglas
Copy link
Contributor

dunglas commented Feb 4, 2025

Thank you for this!!

I had a (very) quick look and the patch looks good to me.

I'll try to build FrankenPHP with it to see if it works, but as I'll be in vacation for 10 days, it may take some time.

@ptondereau
Copy link

Hey 👋🏻
I tried your branch on my frankenphp's fork branch and test is against the ./build-static.sh (updated for purpose) and you can see the result on this GHA here

As you can see, it still fails with:

[11:22:21] [I] musl-cross-make not installed, please install it first. (You can use `doctor` command to install it)

I'm available for any help if needed, of course.

@crazywhalecc
Copy link
Owner Author

crazywhalecc commented Feb 20, 2025

@ptondereau You should use env.custom.ini as document wrote:

Build glibc Compatible Linux Binary

The latest version of static-php-cli includes the bin/spc-gnu-docker script,
which can create a CentOS 7.x (glibc-2.17) Docker container with one click and build a glibc compatible PHP static binary in the container.

First, clone the repository of this project and add the following content to the config/env.custom.ini file:

; Modify this file name to `env.custom.ini`, and run `bin/spc-gnu-docker`,
; you can compile a GNU libc based static binary !
[global]
SPC_SKIP_DOCTOR_CHECK_ITEMS="if musl-wrapper is installed,if musl-cross-make is installed"

[linux]
CC=gcc
CXX=g++
AR=ar
LD=ld
SPC_DEFAULT_C_FLAGS=-fPIC
SPC_NO_MUSL_PATH=yes
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil"

Then, run the following command once.
The first run will take a long time because it needs to download the CentOS 7.x image and some build tools.

bin/spc-gnu-docker

After the image is built, you will see the same command help menu as bin/spc, which means the container is ready.

After the container is ready, you can refer to the local build section to build your PHP static binary.
Just replace bin/spc or ./spc with bin/spc-gnu-docker.

Unlike the default build, when building in the glibc environment, you must add the parameter --libc=glibc, such as:

bin/spc-gnu-docker --libc=glibc build bcmath,ctype,openssl,pdo,phar,posix,session,tokenizer,xml,zip --build-cli --debug

Notes

In rare cases, glibc-based static PHP may encounter segment faults and other errors, but there are currently few examples.
If you encounter any issues, please submit an issue.

glibc build is an extended feature and is not part of the default static-php support.
If you have related issues or requirements, please indicate that you are building based on glibc when submitting an issue.

If you need to build glibc-based binaries without using Docker,
please refer to the bin/spc-gnu-docker script to manually create a similar environment.

Since glibc binaries are not the main goal of the project,
we generally do not test the compatibility of various libraries and extensions under glibc.
If any specific library builds successfully on musl-libc but fails on glibc, please submit an issue.

@crazywhalecc
Copy link
Owner Author

crazywhalecc commented Mar 9, 2025

@dunglas @ptondereau Voilà! I had some time over the weekend to do some small experiments, making a series of changes to spc and building the first glibc-based frankenphp.

I forked frankenphp, made some changes to build-static.sh, and created a Docker script in this branch for temporary testing of one-click building frankenphp, just need to run one command: bin/build-static-frankenphp.

You can check this file in the current branch and the modified content of frankenphp's fork, maybe it will help frankenphp. This also solve some embed warnings and library compatibility.

frankenphp-linux-x86_64.tgz

@dunglas
Copy link
Contributor

dunglas commented Mar 10, 2025

That's awesome. Don't hesitate to open a PR on FrankenPHP, we'll definitely add a glibc-based static build.

I can also finish the FrankenPHP patch if you want.

Thanks again

@crazywhalecc crazywhalecc requested a review from Copilot March 10, 2025 16:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds documentation support for building GNU libc (glibc) based static binaries along with updates to the sidebar navigation and environment variable configuration guides in both English and Chinese. Key changes include:

  • New build guides for glibc compatible Linux binaries in English and Chinese.
  • Updates to sidebar entries to integrate the new build guide links.
  • Enhancements to the environment variables documentation to introduce the use of an override file (config/env.custom.ini).

Reviewed Changes

File Description
docs/en/guide/build-with-glibc.md New guide covering the process of building glibc compatible static binaries.
docs/.vitepress/sidebar.en.ts Updated sidebar entries to include basic and extended build guide sections.
docs/en/guide/env-vars.md Added instructions on using the config/env.custom.ini file for complex build settings.
docs/zh/guide/build-with-glibc.md Chinese version of the glibc build guide.
docs/zh/guide/env-vars.md Chinese update discussing the use of config/env.custom.ini for changing environment vars.
docs/.vitepress/sidebar.zh.ts Updated Chinese sidebar entries to reflect the new navigation structure for guides.
docs/en/guide/index.md Modified link texts in the guide index for clarity.
docs/en/guide/troubleshooting.md Minor addition in troubleshooting guide regarding multiple builds.
docs/zh/guide/troubleshooting.md Chinese troubleshooting guide updated with multiple build reference.

Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.

@crazywhalecc crazywhalecc merged commit 5caaa4d into main Mar 11, 2025
6 of 8 checks passed
@crazywhalecc crazywhalecc deleted the feat/gnu-static branch March 11, 2025 03:50
@henderkes
Copy link
Collaborator

@crazywhalecc you accidentally changed the github url of static-php-cli in the script to crazywhale/static-php-cli instead of crazywhalecc/static-php-cli.

I don't think that's you :P

@crazywhalecc
Copy link
Owner Author

@DubbleClick Where did I missing?

@henderkes
Copy link
Collaborator

@henderkes
Copy link
Collaborator

Sorry to revive this again, but shouldn't the resulting php binary be able to load extensions like xdebug dynamically, on top of the static extensions already statically compiled into it?

SPC_NO_MUSL_PATH=yes
; compiler environments
CC=gcc
CXX=g++
AR=ar
LD=ld.gold
SPC_DEFAULT_C_FLAGS=-fPIE
EXTENSION_DIR=/usr/lib64/php/modules
SPC_CMD_PREFIX_PHP_CONFIGURE="${SPC_PHP_DEFAULT_LD_LIBRARY_PATH_CMD} ./configure --prefix= --with-valgrind=no --enable-shared=yes --enable-static=yes --disable-all --disable-cgi --disable-phpdbg --with-pic"
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm"
; EXTRA_LDFLAGS_PROGRAM for `make` php
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie"

Compiling with --libc=glibc succeeds, but I get the following output when it attempts to load extensions:

[root@svmdev static-php-cli]# buildroot/bin/php -v
PHP Warning:  Failed loading Zend extension 'opcache' (tried: /usr/lib64/php/modules/opcache (/usr/lib64/php/modules/opcache: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/opcache.so (/usr/lib64/php/modules/opcache.so: undefined symbol: zend_ini_boolean_displayer_cb)) in Unknown on line 0
PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /usr/lib64/php/modules/xdebug.so (/usr/lib64/php/modules/xdebug.so: undefined symbol: OnUpdateString), /usr/lib64/php/modules/xdebug.so.so (/usr/lib64/php/modules/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'bz2' (tried: /usr/lib64/php/modules/bz2 (/usr/lib64/php/modules/bz2: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/bz2.so (/usr/lib64/php/modules/bz2.so: undefined symbol: zif_fwrite)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'calendar' (tried: /usr/lib64/php/modules/calendar (/usr/lib64/php/modules/calendar: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/calendar.so (/usr/lib64/php/modules/calendar.so: undefined symbol: add_assoc_zval_ex)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ctype' (tried: /usr/lib64/php/modules/ctype (/usr/lib64/php/modules/ctype: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/ctype.so (/usr/lib64/php/modules/ctype.so: undefined symbol: zend_zval_type_name)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/lib64/php/modules/curl (/usr/lib64/php/modules/curl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/curl.so (/usr/lib64/php/modules/curl.so: undefined symbol: zend_known_strings)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'dom' (tried: /usr/lib64/php/modules/dom (/usr/lib64/php/modules/dom: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/dom.so (/usr/lib64/php/modules/dom.so: undefined symbol: zend_empty_array)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'exif' (tried: /usr/lib64/php/modules/exif (/usr/lib64/php/modules/exif: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/exif.so (/usr/lib64/php/modules/exif.so: undefined symbol: php_stream_stdio_ops)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo' (tried: /usr/lib64/php/modules/fileinfo (/usr/lib64/php/modules/fileinfo: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/fileinfo.so (/usr/lib64/php/modules/fileinfo.so: undefined symbol: file_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ftp' (tried: /usr/lib64/php/modules/ftp (/usr/lib64/php/modules/ftp: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/ftp.so (/usr/lib64/php/modules/ftp.so: undefined symbol: zend_string_init_interned)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib64/php/modules/gd (/usr/lib64/php/modules/gd: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/gd.so (/usr/lib64/php/modules/gd.so: undefined symbol: zend_ini_boolean_displayer_cb)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gettext' (tried: /usr/lib64/php/modules/gettext (/usr/lib64/php/modules/gettext: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/gettext.so (/usr/lib64/php/modules/gettext.so: undefined symbol: php_info_print_table_row)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'iconv' (tried: /usr/lib64/php/modules/iconv (/usr/lib64/php/modules/iconv: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/iconv.so (/usr/lib64/php/modules/iconv.so: undefined symbol: zend_known_strings)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib64/php/modules/intl (/usr/lib64/php/modules/intl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/intl.so (/usr/lib64/php/modules/intl.so: undefined symbol: OnUpdateStringUnempty)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ldap' (tried: /usr/lib64/php/modules/ldap (/usr/lib64/php/modules/ldap: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/ldap.so (/usr/lib64/php/modules/ldap.so: undefined symbol: OnUpdateLong)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mbstring' (tried: /usr/lib64/php/modules/mbstring (/usr/lib64/php/modules/mbstring: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mbstring.so (/usr/lib64/php/modules/mbstring.so: undefined symbol: zend_ini_boolean_displayer_cb)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqlnd' (tried: /usr/lib64/php/modules/mysqlnd (/usr/lib64/php/modules/mysqlnd: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mysqlnd.so (/usr/lib64/php/modules/mysqlnd.so: undefined symbol: OnUpdateBool)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo' (tried: /usr/lib64/php/modules/pdo (/usr/lib64/php/modules/pdo: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo.so (/usr/lib64/php/modules/pdo.so: undefined symbol: zend_ce_exception)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'phar' (tried: /usr/lib64/php/modules/phar (/usr/lib64/php/modules/phar: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/phar.so (/usr/lib64/php/modules/phar.so: undefined symbol: zend_ini_boolean_displayer_cb)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'posix' (tried: /usr/lib64/php/modules/posix (/usr/lib64/php/modules/posix: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/posix.so (/usr/lib64/php/modules/posix.so: undefined symbol: _php_stream_cast)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'shmop' (tried: /usr/lib64/php/modules/shmop (/usr/lib64/php/modules/shmop: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/shmop.so (/usr/lib64/php/modules/shmop.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'simplexml' (tried: /usr/lib64/php/modules/simplexml (/usr/lib64/php/modules/simplexml: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/simplexml.so (/usr/lib64/php/modules/simplexml.so: undefined symbol: zend_empty_array)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium' (tried: /usr/lib64/php/modules/sodium (/usr/lib64/php/modules/sodium: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sodium.so (/usr/lib64/php/modules/sodium.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlite3' (tried: /usr/lib64/php/modules/sqlite3 (/usr/lib64/php/modules/sqlite3: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sqlite3.so (/usr/lib64/php/modules/sqlite3.so: undefined symbol: OnUpdateString)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sysvmsg' (tried: /usr/lib64/php/modules/sysvmsg (/usr/lib64/php/modules/sysvmsg: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sysvmsg.so (/usr/lib64/php/modules/sysvmsg.so: undefined symbol: zend_objects_not_comparable)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sysvsem' (tried: /usr/lib64/php/modules/sysvsem (/usr/lib64/php/modules/sysvsem: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sysvsem.so (/usr/lib64/php/modules/sysvsem.so: undefined symbol: zend_objects_not_comparable)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sysvshm' (tried: /usr/lib64/php/modules/sysvshm (/usr/lib64/php/modules/sysvshm: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sysvshm.so (/usr/lib64/php/modules/sysvshm.so: undefined symbol: zend_objects_not_comparable)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'tokenizer' (tried: /usr/lib64/php/modules/tokenizer (/usr/lib64/php/modules/tokenizer: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/tokenizer.so (/usr/lib64/php/modules/tokenizer.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xml' (tried: /usr/lib64/php/modules/xml (/usr/lib64/php/modules/xml: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xml.so (/usr/lib64/php/modules/xml.so: undefined symbol: zend_string_init_interned)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlwriter' (tried: /usr/lib64/php/modules/xmlwriter (/usr/lib64/php/modules/xmlwriter: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xmlwriter.so (/usr/lib64/php/modules/xmlwriter.so: undefined symbol: zend_string_init_interned)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xsl' (tried: /usr/lib64/php/modules/xsl (/usr/lib64/php/modules/xsl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xsl.so (/usr/lib64/php/modules/xsl.so: undefined symbol: zend_string_init_interned)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php/modules/mysqli (/usr/lib64/php/modules/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mysqli.so (/usr/lib64/php/modules/mysqli.so: undefined symbol: OnUpdateLong)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib64/php/modules/pdo_mysql (/usr/lib64/php/modules/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_mysql.so (/usr/lib64/php/modules/pdo_mysql.so: undefined symbol: OnUpdateStringUnempty)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib64/php/modules/pdo_sqlite (/usr/lib64/php/modules/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_sqlite.so (/usr/lib64/php/modules/pdo_sqlite.so: undefined symbol: zend_known_strings)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlreader' (tried: /usr/lib64/php/modules/xmlreader (/usr/lib64/php/modules/xmlreader: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xmlreader.so (/usr/lib64/php/modules/xmlreader.so: undefined symbol: zend_string_init_interned)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: compiler_globals), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'apcu.so' (tried: /usr/lib64/php/modules/apcu.so (/usr/lib64/php/modules/apcu.so: undefined symbol: OnUpdateBool), /usr/lib64/php/modules/apcu.so.so (/usr/lib64/php/modules/apcu.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.4.4 (cli) (built: Mar 11 2025 12:17:20) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.4.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.4, Copyright (c), by Zend Technologies

Changing --enable-static to --disable-static and without -all-static but get the same problems when trying to load dynamic libraries.

@henderkes
Copy link
Collaborator

Edit: without -all-static I actually get a slightly different error log!

[root@svmdev static-php-cli]# buildroot/bin/php -v
PHP Warning:  Failed loading Zend extension 'opcache' (tried: /usr/lib64/php/modules/opcache (/usr/lib64/php/modules/opcache: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/opcache.so (/usr/lib64/php/modules/opcache.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /usr/lib64/php/modules/xdebug.so (/usr/lib64/php/modules/xdebug.so: undefined symbol: compiler_globals), /usr/lib64/php/modules/xdebug.so.so (/usr/lib64/php/modules/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: bz2: Unable to initialize module
Module compiled with build ID=API20240924,NTS
PHP    compiled with build ID=API20240924,TS
These options need to match
 in Unknown on line 0
PHP Warning:  Module "calendar" is already loaded in Unknown on line 0
PHP Warning:  Module "ctype" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/lib64/php/modules/curl (/usr/lib64/php/modules/curl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/curl.so (/usr/lib64/php/modules/curl.so: undefined symbol: core_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'dom' (tried: /usr/lib64/php/modules/dom (/usr/lib64/php/modules/dom: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/dom.so (/usr/lib64/php/modules/dom.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  Module "exif" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo' (tried: /usr/lib64/php/modules/fileinfo (/usr/lib64/php/modules/fileinfo: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/fileinfo.so (/usr/lib64/php/modules/fileinfo.so: undefined symbol: file_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ftp' (tried: /usr/lib64/php/modules/ftp (/usr/lib64/php/modules/ftp: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/ftp.so (/usr/lib64/php/modules/ftp.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  Module "gd" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: gettext: Unable to initialize module
Module compiled with build ID=API20240924,NTS
PHP    compiled with build ID=API20240924,TS
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'iconv' (tried: /usr/lib64/php/modules/iconv (/usr/lib64/php/modules/iconv: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/iconv.so (/usr/lib64/php/modules/iconv.so: undefined symbol: sapi_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib64/php/modules/intl (/usr/lib64/php/modules/intl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/intl.so (/usr/lib64/php/modules/intl.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ldap' (tried: /usr/lib64/php/modules/ldap (/usr/lib64/php/modules/ldap: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/ldap.so (/usr/lib64/php/modules/ldap.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mbstring' (tried: /usr/lib64/php/modules/mbstring (/usr/lib64/php/modules/mbstring: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mbstring.so (/usr/lib64/php/modules/mbstring.so: undefined symbol: sapi_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqlnd' (tried: /usr/lib64/php/modules/mysqlnd (/usr/lib64/php/modules/mysqlnd: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mysqlnd.so (/usr/lib64/php/modules/mysqlnd.so: undefined symbol: core_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo' (tried: /usr/lib64/php/modules/pdo (/usr/lib64/php/modules/pdo: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo.so (/usr/lib64/php/modules/pdo.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'phar' (tried: /usr/lib64/php/modules/phar (/usr/lib64/php/modules/phar: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/phar.so (/usr/lib64/php/modules/phar.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  Module "posix" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'shmop' (tried: /usr/lib64/php/modules/shmop (/usr/lib64/php/modules/shmop: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/shmop.so (/usr/lib64/php/modules/shmop.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'simplexml' (tried: /usr/lib64/php/modules/simplexml (/usr/lib64/php/modules/simplexml: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/simplexml.so (/usr/lib64/php/modules/simplexml.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium' (tried: /usr/lib64/php/modules/sodium (/usr/lib64/php/modules/sodium: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sodium.so (/usr/lib64/php/modules/sodium.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlite3' (tried: /usr/lib64/php/modules/sqlite3 (/usr/lib64/php/modules/sqlite3: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sqlite3.so (/usr/lib64/php/modules/sqlite3.so: undefined symbol: core_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sysvmsg' (tried: /usr/lib64/php/modules/sysvmsg (/usr/lib64/php/modules/sysvmsg: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/sysvmsg.so (/usr/lib64/php/modules/sysvmsg.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: sysvsem: Unable to initialize module
Module compiled with build ID=API20240924,NTS
PHP    compiled with build ID=API20240924,TS
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: sysvshm: Unable to initialize module
Module compiled with build ID=API20240924,NTS
PHP    compiled with build ID=API20240924,TS
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'tokenizer' (tried: /usr/lib64/php/modules/tokenizer (/usr/lib64/php/modules/tokenizer: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/tokenizer.so (/usr/lib64/php/modules/tokenizer.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xml' (tried: /usr/lib64/php/modules/xml (/usr/lib64/php/modules/xml: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xml.so (/usr/lib64/php/modules/xml.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  Module "xmlwriter" is already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xsl' (tried: /usr/lib64/php/modules/xsl (/usr/lib64/php/modules/xsl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xsl.so (/usr/lib64/php/modules/xsl.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php/modules/mysqli (/usr/lib64/php/modules/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mysqli.so (/usr/lib64/php/modules/mysqli.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib64/php/modules/pdo_mysql (/usr/lib64/php/modules/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_mysql.so (/usr/lib64/php/modules/pdo_mysql.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib64/php/modules/pdo_sqlite (/usr/lib64/php/modules/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_sqlite.so (/usr/lib64/php/modules/pdo_sqlite.so: undefined symbol: core_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlreader' (tried: /usr/lib64/php/modules/xmlreader (/usr/lib64/php/modules/xmlreader: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xmlreader.so (/usr/lib64/php/modules/xmlreader.so: undefined symbol: executor_globals)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: compiler_globals), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'apcu.so' (tried: /usr/lib64/php/modules/apcu.so (/usr/lib64/php/modules/apcu.so: undefined symbol: zend_signal_globals), /usr/lib64/php/modules/apcu.so.so (/usr/lib64/php/modules/apcu.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.4.4 (cli) (built: Mar 11 2025 12:29:16) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.4.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.4, Copyright (c), by Zend Technologies

It recognises some as already loaded:

PHP Warning:  Module "exif" is already loaded in Unknown on line 0

, as they're compiled into the binary, some fail to load due to NTS/TS differences:

PHP Warning:  PHP Startup: sysvshm: Unable to initialize module
Module compiled with build ID=API20240924,NTS
PHP    compiled with build ID=API20240924,TS

But still fails to unrecognised symbols for the only one that I care about:

PHP Warning:  Failed loading Zend extension 'opcache' (tried: /usr/lib64/php/modules/opcache (/usr/lib64/php/modules/opcache: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/opcache.so (/usr/lib64/php/modules/opcache.so: undefined symbol: compiler_globals)) in Unknown on line 0
PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /usr/lib64/php/modules/xdebug.so (/usr/lib64/php/modules/xdebug.so: undefined symbol: compiler_globals), /usr/lib64/php/modules/xdebug.so.so (/usr/lib64/php/modules/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

@crazywhalecc
Copy link
Owner Author

@DubbleClick Let's create a new issue to start this. I haven't really looked into the possibility of dynamically loading extensions, but it should be possible in theory.

For xdebug and opcache, I suspect that it may be the phpmicro patch that affects the results when it is dynamically compiled, but maybe we should start with normal extensions first.

@henderkes
Copy link
Collaborator

I think normal extensions aren't all too useful, at least when creating a NTS build.
The useful ones are the extensions that we cannot build statically (FFI, Xdebug, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mixed PR This PR contains multiple updates new feature New feature or request os/linux Things only for Linux OS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional GNU C Library support

5 participants