From 220c4dab42213709738a355f4557927b8097ddb0 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 25 Oct 2024 16:38:02 +0800 Subject: [PATCH 01/25] Add PHP 8.4 support (testing) --- config/source.json | 2 +- src/SPC/ConsoleApplication.php | 2 +- src/SPC/store/source/PhpSource.php | 2 +- src/globals/test-extensions.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/source.json b/config/source.json index c7ef1e8c1..f1b80bad6 100644 --- a/config/source.json +++ b/config/source.json @@ -513,7 +513,7 @@ "micro": { "type": "git", "path": "php-src/sapi/micro", - "rev": "master", + "rev": "84beta", "url": "https://github.com/static-php/phpmicro", "license": { "type": "file", diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 122a2e6e7..6b44013ca 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -30,7 +30,7 @@ */ final class ConsoleApplication extends Application { - public const VERSION = '2.3.6'; + public const VERSION = '2.3.7'; public function __construct() { diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index 5c3c5f539..c631fe81e 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -21,7 +21,7 @@ public function fetch(bool $force = false, ?array $config = null, int $lock_as = { $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1'; if ($major === '8.4') { - Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~saki/php-8.4.0RC1.tar.xz'], $force); + Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~saki/php-8.4.0RC3.tar.xz'], $force); } else { Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force); } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 4154b93df..59573afa7 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,10 +13,10 @@ // test php version $test_php_version = [ - '8.0', '8.1', '8.2', '8.3', + '8.4', ]; // test os (macos-13, macos-14, ubuntu-latest, windows-latest are available) @@ -36,7 +36,7 @@ $upx = false; // prefer downloading pre-built packages to speed up the build process -$prefer_pre_built = true; +$prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { From 6ed25ed740169d7ff957f93baf7d0b02f9266f53 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 2 Nov 2024 21:44:55 +0800 Subject: [PATCH 02/25] Add 8.4 support for switch-php-version command --- src/SPC/command/SwitchPhpVersionCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SPC/command/SwitchPhpVersionCommand.php b/src/SPC/command/SwitchPhpVersionCommand.php index f0f454dd1..ab91ed07c 100644 --- a/src/SPC/command/SwitchPhpVersionCommand.php +++ b/src/SPC/command/SwitchPhpVersionCommand.php @@ -19,9 +19,9 @@ public function configure() $this->addArgument( 'php-major-version', InputArgument::REQUIRED, - 'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3)', + 'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4)', null, - fn () => ['7.4', '8.0', '8.1', '8.2', '8.3'] + fn () => ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] ); $this->no_motd = true; @@ -31,7 +31,7 @@ public function configure() public function handle(): int { $php_ver = $this->input->getArgument('php-major-version'); - if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) { + if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'])) { // match x.y.z preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches); if (!$matches) { From 0e131f2dba0544cf67d795a01db7e8a162514ad7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 2 Nov 2024 21:47:39 +0800 Subject: [PATCH 03/25] 8.4 download imap separately, compatible with 8.1-8.3 --- config/ext.json | 3 +- config/source.json | 12 ++ src/SPC/store/SourcePatcher.php | 13 ++ src/globals/extra/Apache_LICENSE | 201 +++++++++++++++++++++++++++++++ 4 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 src/globals/extra/Apache_LICENSE diff --git a/config/ext.json b/config/ext.json index efd4aad9c..d89f5ec27 100644 --- a/config/ext.json +++ b/config/ext.json @@ -242,7 +242,8 @@ "BSD": "wip" }, "notes": true, - "type": "builtin", + "type": "external", + "source": "ext-imap", "arg-type": "custom", "lib-depends": [ "imap" diff --git a/config/source.json b/config/source.json index f1b80bad6..cad9e73ad 100644 --- a/config/source.json +++ b/config/source.json @@ -249,6 +249,18 @@ "path": "LICENSE" } }, + "ext-imap": { + "type": "url", + "url": "https://pecl.php.net/get/imap", + "path": "php-src/ext/imap", + "filename": "imap.tgz", + "license": { + "type": "file", + "path": [ + "LICENSE" + ] + } + }, "inotify": { "type": "url", "url": "https://pecl.php.net/get/inotify", diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 86014e7c7..f74b1d843 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -25,6 +25,7 @@ public static function init(): void FileSystem::addSourceExtractHook('pdo_sqlsrv', [SourcePatcher::class, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('yaml', [SourcePatcher::class, 'patchYamlWin32']); FileSystem::addSourceExtractHook('libyaml', [SourcePatcher::class, 'patchLibYaml']); + FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchImapLicense']); } /** @@ -370,6 +371,18 @@ public static function patchLibYaml(string $name, string $target): bool return true; } + /** + * Patch imap license file for PHP < 8.4 + */ + public static function patchImapLicense(): bool + { + if (!file_exists(SOURCE_PATH . '/php-src/ext/imap/LICENSE') && is_dir(SOURCE_PATH . '/php-src/ext/imap')) { + file_put_contents(SOURCE_PATH . '/php-src/ext/imap/LICENSE', file_get_contents(ROOT_DIR . '/src/globals/extra/Apache_LICENSE')); + return true; + } + return false; + } + /** * Patch cli SAPI Makefile for Windows. * diff --git a/src/globals/extra/Apache_LICENSE b/src/globals/extra/Apache_LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/src/globals/extra/Apache_LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 307e984b5dafdc436bbfa2561ce481d3c7213f29 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 01:15:49 +0800 Subject: [PATCH 04/25] Fix imap library build in macOS Sequoia --- src/SPC/builder/macos/library/imap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/macos/library/imap.php b/src/SPC/builder/macos/library/imap.php index 843e0c344..6c2fb3590 100644 --- a/src/SPC/builder/macos/library/imap.php +++ b/src/SPC/builder/macos/library/imap.php @@ -56,7 +56,7 @@ protected function build(): void ->exec('chmod +x src/osdep/unix/drivers') ->exec('chmod +x src/osdep/unix/mkauths') ->exec( - "yes | make osx {$ssl_options} EXTRACFLAGS='-Wimplicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'" + "echo y | make osx {$ssl_options} EXTRACFLAGS='-Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'" ); try { shell() From 6670b56da5914f04e0d2c4a4a1a18947214e5cf1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 01:17:30 +0800 Subject: [PATCH 05/25] Fix display PHP version when using archive --- src/SPC/builder/BuilderBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 5d5f29938..33d187c23 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -276,7 +276,7 @@ public function getPHPVersionFromArchive(?string $file = null): false|string return false; } } - if (preg_match('/php-(\d+\.\d+\.\d+)/', $file, $match)) { + if (preg_match('/php-(\d+\.\d+\.\d+(?:RC\d+)?)\.tar\.(?:gz|bz2|xz)/', $file, $match)) { return $match[1]; } return false; From dc57e5e5c43e44fd6477e33446771bbe81c698d3 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 01:35:29 +0800 Subject: [PATCH 06/25] Remove 8.1-8.3 tests --- src/globals/test-extensions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 59573afa7..3dce98a1a 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,6 @@ // test php version $test_php_version = [ - '8.1', - '8.2', - '8.3', '8.4', ]; From e19644238742912ed716e5c3fedfee659c832e63 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 12:37:00 +0800 Subject: [PATCH 07/25] Change default download php version to 8.3 --- src/SPC/command/DownloadCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/DownloadCommand.php b/src/SPC/command/DownloadCommand.php index 7419c60e6..80ec6eabf 100644 --- a/src/SPC/command/DownloadCommand.php +++ b/src/SPC/command/DownloadCommand.php @@ -30,7 +30,7 @@ public function configure(): void $this->addArgument('sources', InputArgument::REQUIRED, 'The sources will be compiled, comma separated'); $this->addOption('shallow-clone', null, null, 'Clone shallow'); $this->addOption('with-openssl11', null, null, 'Use openssl 1.1'); - $this->addOption('with-php', null, InputOption::VALUE_REQUIRED, 'version in major.minor format (default 8.2)', '8.2'); + $this->addOption('with-php', null, InputOption::VALUE_REQUIRED, 'version in major.minor format (default 8.3)', '8.3'); $this->addOption('clean', null, null, 'Clean old download cache and source before fetch'); $this->addOption('all', 'A', null, 'Fetch all sources that static-php-cli needed'); $this->addOption('custom-url', 'U', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source download url, e.g "php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz"'); From 3f871fde1379c1e0ea4d5b89bcc6bd4153a81f08 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 12:37:40 +0800 Subject: [PATCH 08/25] Change swoole source to git master instead of pecl (6.0 has not been released) --- config/source.json | 11 ++++++++--- src/globals/ext-tests/swoole.php | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/source.json b/config/source.json index cad9e73ad..3d02944e8 100644 --- a/config/source.json +++ b/config/source.json @@ -738,13 +738,18 @@ } }, "swoole": { - "type": "ghtar", "path": "php-src/ext/swoole", - "repo": "swoole/swoole-src", - "prefer-stable": true, + "type": "git", + "rev": "master", + "url": "https://github.com/swoole/swoole-src.git", "license": { "type": "file", "path": "LICENSE" + }, + "alt": { + "type": "ghtar", + "repo": "swoole/swoole-src", + "prefer-stable": true } }, "swow": { diff --git a/src/globals/ext-tests/swoole.php b/src/globals/ext-tests/swoole.php index 9e5752f05..dd539ad41 100644 --- a/src/globals/ext-tests/swoole.php +++ b/src/globals/ext-tests/swoole.php @@ -6,7 +6,6 @@ assert(function_exists('swoole_string')); assert(class_exists('Swoole\Coroutine')); assert(class_exists('Swoole\Coroutine\Http2\Client')); -assert(class_exists('Swoole\Coroutine\Redis')); assert(class_exists('Swoole\Coroutine\WaitGroup')); assert(class_exists('Swoole\Http2\Request')); assert(constant('SWOOLE_VERSION')); From 4a22d2a613bde92d3142ca1d2113ca9deddde890 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 12:37:57 +0800 Subject: [PATCH 09/25] Fix sodium build, remove build patches --- src/SPC/builder/extension/sodium.php | 35 ---------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/SPC/builder/extension/sodium.php diff --git a/src/SPC/builder/extension/sodium.php b/src/SPC/builder/extension/sodium.php deleted file mode 100644 index 180597743..000000000 --- a/src/SPC/builder/extension/sodium.php +++ /dev/null @@ -1,35 +0,0 @@ -removeLineContainingString(); - } - - private function removeLineContainingString(): bool - { - $path = SOURCE_PATH . '/php-src/ext/sodium/config.m4'; - $search = '-Wno-logical-op'; - if (!file_exists($path)) { - return false; - } - $content = file_get_contents($path); - $lines = preg_split('/\r\n|\n/', $content); - $filteredLines = array_filter($lines, function ($line) use ($search) { - return strpos($line, $search) === false; - }); - $newContent = implode("\n", $filteredLines); - file_put_contents($path, $newContent); - return true; - } -} From aa457dfe5c477dd0e4ac1a65bde3a076853025c1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 12:38:49 +0800 Subject: [PATCH 10/25] Update README --- README-zh.md | 22 ++++++++++++---------- README.md | 23 +++++++++++++---------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/README-zh.md b/README-zh.md index 3f8c31df3..b9f74c813 100755 --- a/README-zh.md +++ b/README-zh.md @@ -82,16 +82,18 @@ static-php-cli(简称 `spc`)有许多特性: > > :x: 不支持 -| PHP Version | Status | Comment | -|-------------|--------------------|------------------------------| -| 7.2 | :x: | | -| 7.3 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 | -| 7.4 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 | -| 8.0 | :heavy_check_mark: | PHP 官方已停止 8.0 的维护 | -| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 | -| 8.2 | :heavy_check_mark: | | -| 8.3 | :heavy_check_mark: | | -| 8.4 | :x: | WIP | +| PHP Version | Status | Comment | +|-------------|--------------------|----------------------------------------------| +| 7.2 | :x: | | +| 7.3 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 | +| 7.4 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 | +| 8.0 | :warning: | PHP 官方已停止 8.0 的维护,我们不再处理 8.0 相关的 backport 支持 | +| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 | +| 8.2 | :heavy_check_mark: | | +| 8.3 | :heavy_check_mark: | | +| 8.4 | :heavy_check_mark: | | + +> 这个表格的支持状态是 static-php-cli 对构建对应版本的支持情况,不是 PHP 官方对该版本的支持情况。 ### 支持的扩展 diff --git a/README.md b/README.md index 176d0895e..2288b0281 100755 --- a/README.md +++ b/README.md @@ -89,16 +89,19 @@ Currently supported PHP versions for compilation: > > :x: not supported -| PHP Version | Status | Comment | -|-------------|--------------------|---------------------------------------------------| -| 7.2 | :x: | | -| 7.3 | :warning: | phpmicro and some extensions not supported on 7.x | -| 7.4 | :warning: | phpmicro and some extensions not supported on 7.x | -| 8.0 | :heavy_check_mark: | PHP official has stopped maintenance of 8.0 | -| 8.1 | :heavy_check_mark: | PHP official has security fixes only | -| 8.2 | :heavy_check_mark: | | -| 8.3 | :heavy_check_mark: | | -| 8.4 | :x: | WIP | +| PHP Version | Status | Comment | +|-------------|--------------------|----------------------------------------------------------------------------------------------------| +| 7.2 | :x: | | +| 7.3 | :x: | phpmicro and some extensions not supported on 7.x | +| 7.4 | :x: | phpmicro and some extensions not supported on 7.x | +| 8.0 | :warning: | PHP official has stopped maintenance of 8.0, we no longer provide backport support for version 8.0 | +| 8.1 | :heavy_check_mark: | PHP official has security fixes only | +| 8.2 | :heavy_check_mark: | | +| 8.3 | :heavy_check_mark: | | +| 8.4 | :heavy_check_mark: | | + +> This table shows the support status for static-php-cli in building the corresponding version, +> not the official PHP support status for that version. ### Supported Extensions From 6de66056a54314ef89ca1aedd5a593bff7bf970f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 13:56:02 +0800 Subject: [PATCH 11/25] Remove --with-zlib-dir that has been removed in 8.4 --- src/SPC/builder/extension/zlib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/builder/extension/zlib.php b/src/SPC/builder/extension/zlib.php index 916ee3a23..a4b8d44b0 100644 --- a/src/SPC/builder/extension/zlib.php +++ b/src/SPC/builder/extension/zlib.php @@ -12,6 +12,9 @@ class zlib extends Extension { public function getUnixConfigureArg(): string { + if ($this->builder->getPHPVersionID() >= 80400) { + return '--with-zlib'; + } return '--with-zlib --with-zlib-dir="' . BUILD_ROOT_PATH . '"'; } } From 13523bcdbca698b7ffd2bab3119fad42b9c5de3f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 13:56:36 +0800 Subject: [PATCH 12/25] Fix imagick build for PHP 8.4 --- src/SPC/store/SourcePatcher.php | 10 +++++++ src/globals/patch/imagick_php84.patch | 40 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/globals/patch/imagick_php84.patch diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index f74b1d843..c97ccf8de 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -26,6 +26,7 @@ public static function init(): void FileSystem::addSourceExtractHook('yaml', [SourcePatcher::class, 'patchYamlWin32']); FileSystem::addSourceExtractHook('libyaml', [SourcePatcher::class, 'patchLibYaml']); FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchImapLicense']); + FileSystem::addSourceExtractHook('ext-imagick', [SourcePatcher::class, 'patchImagickWith84']); } /** @@ -383,6 +384,15 @@ public static function patchImapLicense(): bool return false; } + /** + * Patch imagick for PHP 8.4 + */ + public static function patchImagickWith84(): bool + { + SourcePatcher::patchFile('imagick_php84.patch', SOURCE_PATH . '/php-src/ext/imagick'); + return true; + } + /** * Patch cli SAPI Makefile for Windows. * diff --git a/src/globals/patch/imagick_php84.patch b/src/globals/patch/imagick_php84.patch new file mode 100644 index 000000000..8eb98bb1c --- /dev/null +++ b/src/globals/patch/imagick_php84.patch @@ -0,0 +1,40 @@ +From 65e27f2bc02e7e8f1bf64e26e359e42a1331fca1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= +Date: Wed, 25 Sep 2024 10:56:28 +0200 +Subject: [PATCH] Fix removed "php_strtolower" for PHP 8.4 + +--- + imagick.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/imagick.c b/imagick.c +index 1b765389..ebab7ae7 100644 +--- a/imagick.c ++++ b/imagick.c +@@ -610,7 +610,7 @@ static zval *php_imagick_read_property(zend_object *object, zend_string *member, + if (format) { + retval = rv; + ZVAL_STRING(retval, format); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + retval = rv; +@@ -683,7 +683,7 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, voi + if (format) { + retval = rv; + ZVAL_STRING(retval, format); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + retval = rv; +@@ -766,7 +766,7 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, con + + if (format) { + ZVAL_STRING(retval, format, 1); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + ZVAL_STRING(retval, "", 1); \ No newline at end of file From 664a8122adbe6f2a456aa2efd0e6a8af7bb35c86 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 13:56:48 +0800 Subject: [PATCH 13/25] Add 8.1-8.3 test --- src/globals/test-extensions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 3dce98a1a..59573afa7 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,6 +13,9 @@ // test php version $test_php_version = [ + '8.1', + '8.2', + '8.3', '8.4', ]; From e9466dca681161aee4796412d79201d656f3f247 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 5 Nov 2024 11:18:36 +0800 Subject: [PATCH 14/25] Use similar optimize flags for compiling PHP (bump major ver) --- config/env.ini | 2 +- src/SPC/ConsoleApplication.php | 2 +- src/SPC/util/GlobalEnvManager.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/env.ini b/config/env.ini index 948521dd7..3d504baf1 100644 --- a/config/env.ini +++ b/config/env.ini @@ -94,7 +94,7 @@ SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS} -fno-ident ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="" ; EXTRA_LDFLAGS_PROGRAM for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static" +SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie" [macos] ; compiler environments diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 6b44013ca..0ef842b67 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -30,7 +30,7 @@ */ final class ConsoleApplication extends Application { - public const VERSION = '2.3.7'; + public const VERSION = '2.4.0'; public function __construct() { diff --git a/src/SPC/util/GlobalEnvManager.php b/src/SPC/util/GlobalEnvManager.php index 9a30f8d03..6c6c9820f 100644 --- a/src/SPC/util/GlobalEnvManager.php +++ b/src/SPC/util/GlobalEnvManager.php @@ -41,7 +41,7 @@ public static function init(?BuilderBase $builder = null): void self::putenv('PKG_CONFIG=' . BUILD_BIN_PATH . '/pkg-config'); self::putenv('PKG_CONFIG_PATH=' . BUILD_ROOT_PATH . '/lib/pkgconfig'); if ($builder instanceof BuilderBase) { - self::putenv('SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS=' . ($builder->getOption('no-strip') ? '-g -O0' : '-g -Os')); + self::putenv('SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS=' . ($builder->getOption('no-strip') ? '-g -O0' : '-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64')); } } From 23daeeb311208dbca64c088a7cece71431d1ecdc Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 5 Nov 2024 12:54:53 +0800 Subject: [PATCH 15/25] Add extension matrix tests --- .github/workflows/ext-matrix-tests.yml | 148 +++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 .github/workflows/ext-matrix-tests.yml diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml new file mode 100644 index 000000000..f8568ad40 --- /dev/null +++ b/.github/workflows/ext-matrix-tests.yml @@ -0,0 +1,148 @@ +name: "Extension matrix tests" + +on: + workflow_dispatch: + pull_request: + branches: [ "main" ] + paths: + - '.github/workflows/ext-matrix-tests.yml' + +jobs: + test: + name: "${{ matrix.extension }} (PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }})" + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + extension: + - amqp + - apcu + - bcmath + - bz2 + - calendar + - ctype + - curl + - dba + - dom + - ds + - event + - exif + - filter + - fileinfo + - ftp + - gd + - gettext + - gmp + - iconv + - igbinary + - imagick + - imap + - intl + - ldap + - mbstring,mbregex + - memcache + - mysqli,mysqlnd,pdo_mysql + - opcache + - openssl + - pcntl + - password-argon2 + - pcntl + - pdo + - pgsql,pdo_pgsql + - phar + - posix + - rar + - protobuf + - readline + - redis + - session + - shmop + - simdjson + - simplexml,xml + - snappy + - soap + - sockets + - sodium + - sqlite3,pdo_sqlite + - sqlsrv + - ssh2 + - swoole + - swoole,swoole-hook-pgsql,swoole-hook-mysql,swoole-hook-sqlite + - swow + - sysvmsg,sysvsem,sysvshm + - tidy + - tokenizer + - uuid + - uv + - xhprof + - xlswriter + - xmlwriter,xmlreader + - xsl + - yac + - yaml + - zip + - zlib + - zstd + php-version: + - "8.4" + operating-system: + - "ubuntu-latest" + #- "macos-13" + #- "debian-arm64-self-hosted" + - "macos-14" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: OS type + id: os-type + run: | + OS="" + if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then + OS="linux-x86_64" + elif [ "${{ matrix.operating-system }}" = "macos-13" ]; then + OS="macos-x86_64" + elif [ "${{ matrix.operating-system }}" = "debian-arm64-self-hosted" ]; then + OS="linux-aarch64" + elif [ "${{ matrix.operating-system }}" = "macos-14" ]; then + OS="macos-aarch64" + fi + echo "OS=$OS" >> $GITHUB_ENV + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: pecl, composer + extensions: curl, openssl, mbstring + ini-values: memory_limit=-1 + env: + phpts: nts + + - name: "Install Dependencies" + run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - id: cache-download + uses: actions/cache@v4 + with: + path: downloads + key: php-${{ matrix.php-version }}-dependencies-for-tests + + # If there's no dependencies cache, fetch sources + - name: "Download sources" + env: + GITHUB_TOKEN: ${{ secrets.S_GITHUB_TOKEN }} + run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug + + - name: "Build library: ${{ matrix.library }}" + run: | + SPC_USE_SUDO=yes ./bin/spc doctor --auto-fix + if [ "${{ env.OS }}" = "linux-x86_64" ]; then + ./bin/spc install-pkg upx + UPX=--with-upx-pack + elif [ "${{ env.OS }}" = "linux-aarch64" ]; then + ./bin/spc install-pkg upx + UPX=--with-upx-pack + fi + ./bin/spc build --build-cli --build-micro --build-fpm ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts From dc3f3dfcaa5c911113e85ccb8282e9af291fc806 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 5 Nov 2024 12:58:09 +0800 Subject: [PATCH 16/25] Do not cache PHP --- .github/workflows/ext-matrix-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml index f8568ad40..4e7bd314a 100644 --- a/.github/workflows/ext-matrix-tests.yml +++ b/.github/workflows/ext-matrix-tests.yml @@ -132,8 +132,8 @@ jobs: # If there's no dependencies cache, fetch sources - name: "Download sources" env: - GITHUB_TOKEN: ${{ secrets.S_GITHUB_TOKEN }} - run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src - name: "Build library: ${{ matrix.library }}" run: | From 8da3f3581568d7cfb5d16861279a4b6d2f4c2a86 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 6 Nov 2024 16:29:17 +0800 Subject: [PATCH 17/25] Fix gettext sanity check --- src/globals/ext-tests/gettext.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/globals/ext-tests/gettext.php b/src/globals/ext-tests/gettext.php index c161d682b..a50baa5dc 100644 --- a/src/globals/ext-tests/gettext.php +++ b/src/globals/ext-tests/gettext.php @@ -5,7 +5,6 @@ assert(function_exists('gettext')); assert(function_exists('bindtextdomain')); assert(function_exists('textdomain')); -assert(function_exists('bind_textdomain_codeset')); if (!is_dir('locale/en_US/LC_MESSAGES/')) { mkdir('locale/en_US/LC_MESSAGES/', 0755, true); @@ -19,7 +18,6 @@ $domain = 'test'; bindtextdomain($domain, 'locale/'); -bind_textdomain_codeset($domain, 'UTF-8'); textdomain($domain); assert(gettext(json_decode('"\u793a\u4f8b"', true)) === 'Example'); From 237fc535b4c1f8b15b4c94cdd07b7914fcc0502d Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 6 Nov 2024 16:45:45 +0800 Subject: [PATCH 18/25] Fix FileSystem remove soft link directory --- src/SPC/store/FileSystem.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/store/FileSystem.php b/src/SPC/store/FileSystem.php index 4b5b32d66..5780a216a 100644 --- a/src/SPC/store/FileSystem.php +++ b/src/SPC/store/FileSystem.php @@ -367,6 +367,9 @@ public static function removeDir(string $dir): bool } } } + if (is_link($dir)) { + return unlink($dir); + } return rmdir($dir); } From 7c59e4d635677036f41ea91a51b31fb7f23e9a74 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 9 Nov 2024 17:39:29 +0800 Subject: [PATCH 19/25] Update to RC4 --- src/SPC/store/source/PhpSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index c631fe81e..c1d8dad49 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -21,7 +21,7 @@ public function fetch(bool $force = false, ?array $config = null, int $lock_as = { $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1'; if ($major === '8.4') { - Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~saki/php-8.4.0RC3.tar.xz'], $force); + Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~calvinb/php-8.4.0RC4.tar.xz'], $force); } else { Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force); } From eaa9969d268a90ac34f6650418e315e344be7cda Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 22 Nov 2024 15:11:15 +0800 Subject: [PATCH 20/25] Remove RC version for PHP 8.4 --- src/SPC/store/source/PhpSource.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index c1d8dad49..d15fd40fd 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -19,12 +19,8 @@ class PhpSource extends CustomSourceBase */ public function fetch(bool $force = false, ?array $config = null, int $lock_as = SPC_LOCK_SOURCE): void { - $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1'; - if ($major === '8.4') { - Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~calvinb/php-8.4.0RC4.tar.xz'], $force); - } else { - Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force); - } + $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.3'; + Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force); } /** From 42abb5aa2298391639174fad0c1dc6357b98d0b7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 22 Nov 2024 15:11:20 +0800 Subject: [PATCH 21/25] Sort config --- config/source.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/config/source.json b/config/source.json index 3d02944e8..f01d29499 100644 --- a/config/source.json +++ b/config/source.json @@ -102,6 +102,18 @@ "path": "LICENSE" } }, + "ext-imap": { + "type": "url", + "url": "https://pecl.php.net/get/imap", + "path": "php-src/ext/imap", + "filename": "imap.tgz", + "license": { + "type": "file", + "path": [ + "LICENSE" + ] + } + }, "ext-memcache": { "type": "url", "url": "https://pecl.php.net/get/memcache", @@ -249,18 +261,6 @@ "path": "LICENSE" } }, - "ext-imap": { - "type": "url", - "url": "https://pecl.php.net/get/imap", - "path": "php-src/ext/imap", - "filename": "imap.tgz", - "license": { - "type": "file", - "path": [ - "LICENSE" - ] - } - }, "inotify": { "type": "url", "url": "https://pecl.php.net/get/inotify", From 6598ddec551e975ff6d1c941d2c3c60ca48f1f53 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 22 Nov 2024 15:22:57 +0800 Subject: [PATCH 22/25] Update docs --- docs/en/faq/index.md | 8 ++++++++ docs/en/guide/extension-notes.md | 2 +- docs/en/guide/index.md | 2 +- docs/en/guide/manual-build.md | 12 ++++++------ docs/zh/faq/index.md | 8 +++++++- docs/zh/guide/extension-notes.md | 2 +- docs/zh/guide/index.md | 2 +- docs/zh/guide/manual-build.md | 12 ++++++------ 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/docs/en/faq/index.md b/docs/en/faq/index.md index 05881ca88..7cef18f66 100644 --- a/docs/en/faq/index.md +++ b/docs/en/faq/index.md @@ -84,3 +84,11 @@ For Linux systems, you can download the [cacert.pem](https://curl.se/docs/caextr For the certificate locations of different distros, please refer to [Golang docs](https://go.dev/src/crypto/x509/root_linux.go). > INI configuration `openssl.cafile` cannot be set dynamically using the `ini_set()` function, because `openssl.cafile` is a `PHP_INI_SYSTEM` type configuration and can only be set in the `php.ini` file. + +## Why don't we support older versions of PHP? + +Because older versions of PHP have many problems, such as security issues, performance issues, and functional issues. +In addition, many older versions of PHP are not compatible with the latest dependency libraries, +which is one of the reasons why older versions of PHP are not supported. + +You can use older versions compiled earlier by static-php-cli, such as PHP 8.0, but earlier versions will not be explicitly supported. diff --git a/docs/en/guide/extension-notes.md b/docs/en/guide/extension-notes.md index fc6b170f8..5cd4e436e 100644 --- a/docs/en/guide/extension-notes.md +++ b/docs/en/guide/extension-notes.md @@ -46,7 +46,7 @@ This extension contains an implementation of the coroutine environment for `pdo_ ## swow -1. Only PHP version >= 8.0 is supported. +1. Only PHP 8.0 ~ 8.3 is supported. ## imap diff --git a/docs/en/guide/index.md b/docs/en/guide/index.md index 41a6b383f..6ae37db73 100644 --- a/docs/en/guide/index.md +++ b/docs/en/guide/index.md @@ -36,7 +36,7 @@ Windows currently only supports the x86_64 architecture, and does not support 32 ## Supported PHP Version -Currently, static php cli supports PHP versions 8.0 to 8.3, and theoretically supports PHP 7.4 and earlier versions. +Currently, static php cli supports PHP versions 8.1 to 8.4, and theoretically supports PHP 8.0 and earlier versions. Simply select the earlier version when downloading. However, due to some extensions and special components that have stopped supporting earlier versions of PHP, static-php-cli will not explicitly support earlier versions. diff --git a/docs/en/guide/manual-build.md b/docs/en/guide/manual-build.md index ba0232548..74d75118e 100644 --- a/docs/en/guide/manual-build.md +++ b/docs/en/guide/manual-build.md @@ -142,9 +142,9 @@ including php-src and the source code of various dependent libraries. # Download all dependencies bin/spc download --all -# Download all dependent packages, and specify the main version of PHP to download, optional: 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 +# Download all dependent packages, and specify the main version of PHP to download, optional: 8.1, 8.2, 8.3, 8.4 # Also supports specific version of php release: 8.3.10, 8.2.22, etc. -bin/spc download --all --with-php=8.2 +bin/spc download --all --with-php=8.3 # Show download progress bar while downloading (curl) bin/spc download --all --debug @@ -272,12 +272,12 @@ If you want to build multiple versions of PHP and don't want to build other depe you can use `switch-php-version` to quickly switch to another version and compile after compiling one version: ```shell -# switch to 8.3 -bin/spc switch-php-version 8.3 +# switch to 8.4 +bin/spc switch-php-version 8.4 # build bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli -# switch to 8.0 -bin/spc switch-php-version 8.0 +# switch to 8.1 +bin/spc switch-php-version 8.1 # build bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli ``` diff --git a/docs/zh/faq/index.md b/docs/zh/faq/index.md index f36313cdd..73f64050c 100644 --- a/docs/zh/faq/index.md +++ b/docs/zh/faq/index.md @@ -70,4 +70,10 @@ PHP 代码的编译器是完全不同的项目,因此不会考虑额外的情 对于 Linux 系统,你可以从 curl 官方网站下载 [cacert.pem](https://curl.se/docs/caextract.html) 文件,也可以使用系统自带的证书文件。 有关不同发行版的证书位置,可参考 [Go 标准库](https://go.dev/src/crypto/x509/root_linux.go)。 -> INI 配置 `openssl.cafile` 不可以使用 `ini_set()` 函数动态设置,因为 `openssl.cafile` 是一个 `PHP_INI_SYSTEM` 类型的配置,只能在 `php.ini` 文件中设置。 \ No newline at end of file +> INI 配置 `openssl.cafile` 不可以使用 `ini_set()` 函数动态设置,因为 `openssl.cafile` 是一个 `PHP_INI_SYSTEM` 类型的配置,只能在 `php.ini` 文件中设置。 + +## 为什么不支持旧版本 PHP ? + +因为旧版本的 PHP 有很多问题,比如安全问题、性能问题、功能问题等。此外,旧版本的 PHP 很多都无法与最新的依赖库兼容,这也是不支持旧版本 PHP 的原因之一。 + +你可以使用 static-php-cli 早期编译好的旧版本,如 PHP 8.0,但是不会明确支持早期版本。 diff --git a/docs/zh/guide/extension-notes.md b/docs/zh/guide/extension-notes.md index 4fc475e36..cf757d1b8 100644 --- a/docs/zh/guide/extension-notes.md +++ b/docs/zh/guide/extension-notes.md @@ -43,7 +43,7 @@ swoole-hook-sqlite 与 `pdo_sqlite` 扩展冲突。如需使用 Swoole 和 `pdo_ ## swow -1. swow 仅支持 PHP >= 8.0 版本。 +1. swow 仅支持 PHP 8.0 ~ 8.3 版本。 ## imap diff --git a/docs/zh/guide/index.md b/docs/zh/guide/index.md index 7fcfafaf2..eb0674c3e 100644 --- a/docs/zh/guide/index.md +++ b/docs/zh/guide/index.md @@ -29,6 +29,6 @@ Windows 目前只支持 x86_64 架构,不支持 32 位 x86、不支持 arm64 ## PHP 支持版本 -目前,static-php-cli 对 PHP 7.4 ~ 8.3 版本是支持的,对于 PHP 7.4 及更早版本理论上支持,只需下载时选择早期版本即可。 +目前,static-php-cli 对 PHP 8.1 ~ 8.4 版本是支持的,对于 PHP 8.0 及更早版本理论上支持,只需下载时选择早期版本即可。 但由于部分扩展和特殊组件已对早期版本的 PHP 停止了支持,所以 static-php-cli 不会明确支持早期版本。 我们推荐你编译尽可能新的 PHP 版本,以获得更好的体验。 diff --git a/docs/zh/guide/manual-build.md b/docs/zh/guide/manual-build.md index 2e7c17f55..06d26a2cc 100644 --- a/docs/zh/guide/manual-build.md +++ b/docs/zh/guide/manual-build.md @@ -141,8 +141,8 @@ bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built # 下载所有依赖包 bin/spc download --all -# 下载所有依赖包,并指定下载的 PHP 主版本,可选:7.3,7.4,8.0,8.1,8.2,8.3,也可以使用特定的版本,如 8.3.10。 -bin/spc download --all --with-php=8.2 +# 下载所有依赖包,并指定下载的 PHP 主版本,可选:8.1,8.2,8.3,8.4,也可以使用特定的版本,如 8.3.10。 +bin/spc download --all --with-php=8.3 # 下载时显示下载进度条(curl) bin/spc download --all --debug @@ -236,12 +236,12 @@ bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli 如果你想构建多个版本的 PHP,且不想每次都重复构建其他依赖库,可以使用 `switch-php-version` 在编译好一个版本后快速切换至另一个版本并编译: ```shell -# switch to 8.3 -bin/spc switch-php-version 8.3 +# switch to 8.4 +bin/spc switch-php-version 8.4 # build bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli -# switch to 8.0 -bin/spc switch-php-version 8.0 +# switch to 8.1 +bin/spc switch-php-version 8.1 # build bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli ``` From 5e4b266dfca83eb009aec0edd5c561f178240fa5 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 22 Nov 2024 15:25:55 +0800 Subject: [PATCH 23/25] Update workflows, add php 8.4 --- .github/workflows/build-linux-arm.yml | 3 ++- .github/workflows/build-linux-x86_64.yml | 3 ++- .github/workflows/build-macos-aarch64.yml | 3 ++- .github/workflows/build-macos-x86_64.yml | 3 ++- .github/workflows/build-windows-x86_64.yml | 1 + .github/workflows/tests.yml | 1 + 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-linux-arm.yml b/.github/workflows/build-linux-arm.yml index cd5acd539..34912f210 100644 --- a/.github/workflows/build-linux-arm.yml +++ b/.github/workflows/build-linux-arm.yml @@ -12,9 +12,10 @@ on: version: required: true description: php version to compile - default: '8.2' + default: '8.3' type: choice options: + - '8.4' - '8.3' - '8.2' - '8.1' diff --git a/.github/workflows/build-linux-x86_64.yml b/.github/workflows/build-linux-x86_64.yml index a637dd7c2..8fb286679 100644 --- a/.github/workflows/build-linux-x86_64.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -6,9 +6,10 @@ on: version: required: true description: php version to compile - default: '8.2' + default: '8.3' type: choice options: + - '8.4' - '8.3' - '8.2' - '8.1' diff --git a/.github/workflows/build-macos-aarch64.yml b/.github/workflows/build-macos-aarch64.yml index 0ffe4bd29..f8d6033fc 100644 --- a/.github/workflows/build-macos-aarch64.yml +++ b/.github/workflows/build-macos-aarch64.yml @@ -6,9 +6,10 @@ on: version: required: true description: php version to compile - default: '8.2' + default: '8.3' type: choice options: + - '8.4' - '8.3' - '8.2' - '8.1' diff --git a/.github/workflows/build-macos-x86_64.yml b/.github/workflows/build-macos-x86_64.yml index d02bd09f0..205b20c5d 100644 --- a/.github/workflows/build-macos-x86_64.yml +++ b/.github/workflows/build-macos-x86_64.yml @@ -6,9 +6,10 @@ on: version: required: true description: php version to compile - default: '8.2' + default: '8.3' type: choice options: + - '8.4' - '8.3' - '8.2' - '8.1' diff --git a/.github/workflows/build-windows-x86_64.yml b/.github/workflows/build-windows-x86_64.yml index 17664851b..32b636528 100644 --- a/.github/workflows/build-windows-x86_64.yml +++ b/.github/workflows/build-windows-x86_64.yml @@ -9,6 +9,7 @@ on: default: '8.2' type: choice options: + - '8.4' - '8.3' - '8.2' - '8.1' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bfec641b6..6548fb886 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,6 +82,7 @@ jobs: - php: '8.1' - php: '8.2' - php: '8.3' + - php: '8.4' steps: - name: "Checkout" From 4b2800793d36e6bcbf726784621c110c9ff318ec Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 23 Nov 2024 11:51:21 +0800 Subject: [PATCH 24/25] Remove PHP 8.1 libxml2 patch --- src/SPC/store/SourcePatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index c97ccf8de..b4c3b9337 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -439,7 +439,7 @@ public static function patchPhpLibxml212(): bool return true; } if ($ver_id < 80200) { - self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src'); + // self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src'); self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src'); return true; } From bdadc47240403098b4358b17d4b7f9d81f31e773 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 23 Nov 2024 11:53:08 +0800 Subject: [PATCH 25/25] Update docs --- docs/en/guide/extension-notes.md | 2 +- docs/zh/guide/extension-notes.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/guide/extension-notes.md b/docs/en/guide/extension-notes.md index 5cd4e436e..95145653c 100644 --- a/docs/en/guide/extension-notes.md +++ b/docs/en/guide/extension-notes.md @@ -46,7 +46,7 @@ This extension contains an implementation of the coroutine environment for `pdo_ ## swow -1. Only PHP 8.0 ~ 8.3 is supported. +1. Only PHP 8.0 ~ 8.4 is supported. ## imap diff --git a/docs/zh/guide/extension-notes.md b/docs/zh/guide/extension-notes.md index cf757d1b8..9c5d9296f 100644 --- a/docs/zh/guide/extension-notes.md +++ b/docs/zh/guide/extension-notes.md @@ -43,7 +43,7 @@ swoole-hook-sqlite 与 `pdo_sqlite` 扩展冲突。如需使用 Swoole 和 `pdo_ ## swow -1. swow 仅支持 PHP 8.0 ~ 8.3 版本。 +1. swow 仅支持 PHP 8.0 ~ 8.4 版本。 ## imap