Repository navigation
Conversation
|
Waiting for php-build/php-build#796 to be approved by php-build's maintainer |
…d/compile - Replace custom download and compilation logic with php-build - Add automatic OpenSSL 1.1 compatibility detection and installation - Add compiler warning fixes for modern GCC versions - Add automated Composer installation with signature verification - Add Xdebug installation support - Add comprehensive patches for PHP 7.4 and 8.0 compatibility - Add post-plugin-add hook for automatic php-build initialization - Add latest-stable version resolution - Add extensive documentation and testing instructions - Add support for all php-build environment variables and options This addresses build failures on modern systems and provides a more maintainable and feature-rich PHP installation experience.
…9 examples - Add comprehensive installation examples for latest stable version - Include verbose installation options and custom compiler flags - Add monitoring instructions with log file tailing - Improve command consistency using 'asdf plugin add php $(pwd)' - Document verification steps for successful installations
a1f1048 to
8e37fe6
Compare
- Remove spaces around redirection operators (&>/dev/null, >/dev/null, >>, etc.) - Conform to shfmt standard formatting rules (-s -i 2 -ci) - Resolves CI format check failure
- Fix SC2155: Separate variable declaration and assignment to avoid masking return codes - Fix SC2086: Add proper quoting for variables to prevent word splitting - Fix SC2034: Remove unused php_status variable - Apply fixes to bin/install and bin/exec-env - All shellcheck warnings resolved while maintaining functionality
c70d153 to
3b506dd
Compare
Replace manual asdf/PHP setup with asdf-vm/actions/plugin-test and remove ad-hoc asdf install and plugin steps. Add a non-fatal Composer version check and initialize git submodules earlier, setting executable permissions. Use asdf-vm/actions/setup and asdf-vm/actions/install to provide shfmt, shellcheck and make, and simplify lint/format commands.
Use apt-get to install shellcheck and make and download shfmt v3.8.0 Drop asdf-vm actions from workflow
Provide giturl and gitref environment inputs so the PHP setup action can access the current repository and checkout the exact commit.
Add asdf setup action and install the plugin from the current checkout, then install and set the PHP version globally. Increase the test step timeout to 30 minutes.
9c7a281 to
a2774e5
Compare
61240f5 to
eced91b
Compare
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/workflow.yml">
<violation number="1" location=".github/workflows/workflow.yml:52">
P2: This adds a second identical Ubuntu `latest` matrix entry, so CI builds that configuration twice without adding coverage. Remove the duplicate entry.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| - os: macos-latest | ||
| version: 7.4.14 | ||
| is_legacy: true | ||
| - os: ubuntu-latest |
There was a problem hiding this comment.
P2: This adds a second identical Ubuntu latest matrix entry, so CI builds that configuration twice without adding coverage. Remove the duplicate entry.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/workflow.yml, line 52:
<comment>This adds a second identical Ubuntu `latest` matrix entry, so CI builds that configuration twice without adding coverage. Remove the duplicate entry.</comment>
<file context>
@@ -46,13 +46,15 @@ jobs:
+ - os: macos-latest
+ version: 7.4.14
+ is_legacy: true
+ - os: ubuntu-latest
+ version: latest
+ is_legacy: false
</file context>
…f, sha1) for PHP 7.4
|
Now, I am testing it to my local mac and linux server |
|
The php-build rewrite drops the optional extensions on MacOS, though the README still says to brew install gmp libsodium. On Linux, sodium was never enabled (#147), which breaks composer install for packages that need ext-sodium. Could they be detected the way tidy already is? (I tested this against the current bin/install on Debian 12 with PHP 8.2.34.) CI could also assert them in "Test PHP installation". php --ri exits 1 when an extension is missing: I have created Rusydy#1 with my suggestions |
|
thank you for your suggestion |
php-build's default configure options include --with-bz2, so configure fails with "Please reinstall the BZip2 distribution" without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
php-build's default configure options include neither --with-sodium nor --with-gmp, so installing libsodium or gmp had no effect, and composer install fails for packages that require ext-sodium. Add both flags when pkg-config finds the library, on Linux and macOS. The flags take no DIR because PHP < 8.4 then looks for DIR/include/gmp.h, which Debian's multiarch layout lacks. A sodium or gmp flag in PHP_CONFIGURE_OPTIONS takes precedence. CI installs both libraries and checks with php --ri that openssl, curl, sodium and gmp are loaded. Fixes asdf-community#147 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/install_optional_extensions.bats">
<violation number="1" location="tests/install_optional_extensions.bats:57">
P2: This assertion cannot verify that missing libraries add no configure flags because `run setup_optional_extensions` runs in a subshell and does not propagate `PHP_BUILD_CONFIGURE_OPTS` back to the test. Invoke the function directly while redirecting its output to a temporary file, then assert against the captured file and the updated variable.</violation>
</file>
<file name=".github/workflows/workflow.yml">
<violation number="1" location=".github/workflows/workflow.yml:22">
P1: The Ubuntu CI dependencies still omit `libbz2-dev`, so php-build's default `--with-bz2` configuration can fail with “Please reinstall the BZip2 distribution” before any Ubuntu matrix job completes. Add `libbz2-dev` to this package list.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
View guided diff | Re-trigger cubic
| version: ${{ matrix.php-version }} | ||
| env: | ||
| # Common dependencies for all builds | ||
| UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libgmp-dev libreadline-dev libsodium-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin" |
There was a problem hiding this comment.
P1: The Ubuntu CI dependencies still omit libbz2-dev, so php-build's default --with-bz2 configuration can fail with “Please reinstall the BZip2 distribution” before any Ubuntu matrix job completes. Add libbz2-dev to this package list.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/workflow.yml, line 22:
<comment>The Ubuntu CI dependencies still omit `libbz2-dev`, so php-build's default `--with-bz2` configuration can fail with “Please reinstall the BZip2 distribution” before any Ubuntu matrix job completes. Add `libbz2-dev` to this package list.</comment>
<file context>
@@ -19,8 +19,8 @@ on:
# Common dependencies for all builds
- UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin"
- MACOS_DEPS: "autoconf automake bison freetype gd gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip openssl@3 pkg-config re2c zlib bzip2"
+ UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libgmp-dev libreadline-dev libsodium-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin"
+ MACOS_DEPS: "autoconf automake bison freetype gd gettext icu4c krb5 gmp libedit libiconv libjpeg libpng libsodium libxml2 libzip openssl@3 pkg-config re2c zlib bzip2"
</file context>
| UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libgmp-dev libreadline-dev libsodium-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin" | |
| UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libbz2-dev libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libgmp-dev libreadline-dev libsodium-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin" |
| @test "should report missing libraries and add no flags" { | ||
| export MOCK_PKG_CONFIG_PACKAGES="" | ||
|
|
||
| run setup_optional_extensions |
There was a problem hiding this comment.
P2: This assertion cannot verify that missing libraries add no configure flags because run setup_optional_extensions runs in a subshell and does not propagate PHP_BUILD_CONFIGURE_OPTS back to the test. Invoke the function directly while redirecting its output to a temporary file, then assert against the captured file and the updated variable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/install_optional_extensions.bats, line 57:
<comment>This assertion cannot verify that missing libraries add no configure flags because `run setup_optional_extensions` runs in a subshell and does not propagate `PHP_BUILD_CONFIGURE_OPTS` back to the test. Invoke the function directly while redirecting its output to a temporary file, then assert against the captured file and the updated variable.</comment>
<file context>
@@ -0,0 +1,81 @@
+@test "should report missing libraries and add no flags" {
+ export MOCK_PKG_CONFIG_PACKAGES=""
+
+ run setup_optional_extensions
+
+ [[ "$output" == *"libsodium not found"* ]]
</file context>
…tallation documentation
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/local-testing-manually.md">
<violation number="1" location="docs/local-testing-manually.md:5">
P3: Remove the trailing whitespace from the new heading and commands; it violates this repository's `.editorconfig` convention and makes `git diff --check` fail.</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Re-trigger cubic
|
|
||
| Below are the steps to install different versions of PHP using asdf in local environment. | ||
|
|
||
| ## install 8.5.11 |
There was a problem hiding this comment.
P3: Remove the trailing whitespace from the new heading and commands; it violates this repository's .editorconfig convention and makes git diff --check fail.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/local-testing-manually.md, line 5:
<comment>Remove the trailing whitespace from the new heading and commands; it violates this repository's `.editorconfig` convention and makes `git diff --check` fail.</comment>
<file context>
@@ -2,13 +2,13 @@
Below are the steps to install different versions of PHP using asdf in local environment.
-## install 8.5.4
+## install 8.5.11
```bash
</file context>
| ## install 8.5.11 | |
| ## install 8.5.11 |
Use PHP's `extension_loaded` directly instead of piping `php -m` through `grep -q`, and add regression tests for the pipefail behavior.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/install_composer.bats">
<violation number="1" location="tests/install_composer.bats:1">
P2: This new Bats file is not run by the pull-request CI, so these Composer regression tests provide no automated protection. Add a CI step or job that invokes `make test` (or `bats tests/*.bats`).</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| @@ -0,0 +1,119 @@ | |||
| #!/usr/bin/env bats | |||
There was a problem hiding this comment.
P2: This new Bats file is not run by the pull-request CI, so these Composer regression tests provide no automated protection. Add a CI step or job that invokes make test (or bats tests/*.bats).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/install_composer.bats, line 1:
<comment>This new Bats file is not run by the pull-request CI, so these Composer regression tests provide no automated protection. Add a CI step or job that invokes `make test` (or `bats tests/*.bats`).</comment>
<file context>
@@ -0,0 +1,119 @@
+#!/usr/bin/env bats
+
+# Tests for the extension checks at the top of install_composer(). Under pipefail, `php -m | grep -q`
</file context>
PHP 8.3.x does not build against openssl@4 headers. Point PKG_CONFIG_PATH, LDFLAGS and --with-openssl at openssl@3 when it is installed, unless an OpenSSL is already chosen.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/install_openssl.bats">
<violation number="1" location="tests/install_openssl.bats:48">
P3: This idempotency test never reaches the duplicate-config guard: the first call puts openssl@3 first in `PKG_CONFIG_PATH`, causing the second call to return earlier. Clear `PKG_CONFIG_PATH` between calls so the test also catches duplicate `--with-openssl` options.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| install_fake_openssl3 | ||
| link_openssl4 | ||
|
|
||
| setup_openssl_pin |
There was a problem hiding this comment.
P3: This idempotency test never reaches the duplicate-config guard: the first call puts openssl@3 first in PKG_CONFIG_PATH, causing the second call to return earlier. Clear PKG_CONFIG_PATH between calls so the test also catches duplicate --with-openssl options.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/install_openssl.bats, line 48:
<comment>This idempotency test never reaches the duplicate-config guard: the first call puts openssl@3 first in `PKG_CONFIG_PATH`, causing the second call to return earlier. Clear `PKG_CONFIG_PATH` between calls so the test also catches duplicate `--with-openssl` options.</comment>
<file context>
@@ -0,0 +1,133 @@
+ install_fake_openssl3
+ link_openssl4
+
+ setup_openssl_pin
+
+ [[ "${PKG_CONFIG_PATH}" == "${TEST_TEMP_DIR}/opt/openssl@3/lib/pkgconfig"* ]]
</file context>
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="README.md">
<violation number="1" location="README.md:46">
P3: `tidy` is not part of every default build: macOS enables it only when `tidy-html5` is installed, and legacy Linux builds explicitly disable it. Reword this as conditional support so users do not assume `ext/tidy` is present after following only the required dependencies.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| `gmp` and `libsodium` are enabled automatically when pkg-config finds their libraries, on Linux and macOS. To skip one, add `--without-gmp` or `--without-sodium` to `PHP_CONFIGURE_OPTIONS`. | ||
|
|
||
| Composer is installed globally alongside PHP by default. If your application requires additional php extensions, you may need to install them via `pecl`. For example: | ||
| `tidy` is part of the default build. On macOS, install `tidy-html5`, or build without tidy by setting `PHP_CONFIGURE_OPTIONS="--without-tidy"`. |
There was a problem hiding this comment.
P3: tidy is not part of every default build: macOS enables it only when tidy-html5 is installed, and legacy Linux builds explicitly disable it. Reword this as conditional support so users do not assume ext/tidy is present after following only the required dependencies.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At README.md, line 46:
<comment>`tidy` is not part of every default build: macOS enables it only when `tidy-html5` is installed, and legacy Linux builds explicitly disable it. Reword this as conditional support so users do not assume `ext/tidy` is present after following only the required dependencies.</comment>
<file context>
@@ -41,6 +41,10 @@ brew install autoconf automake bison freetype gd gettext icu4c krb5 \
+`gmp` and `libsodium` are enabled automatically when pkg-config finds their libraries, on Linux and macOS. To skip one, add `--without-gmp` or `--without-sodium` to `PHP_CONFIGURE_OPTIONS`.
+
+`tidy` is part of the default build. On macOS, install `tidy-html5`, or build without tidy by setting `PHP_CONFIGURE_OPTIONS="--without-tidy"`.
+
## Installation
</file context>
| `tidy` is part of the default build. On macOS, install `tidy-html5`, or build without tidy by setting `PHP_CONFIGURE_OPTIONS="--without-tidy"`. | |
| `tidy` is enabled when its library is available. On macOS, install `tidy-html5`, or build without tidy by setting `PHP_CONFIGURE_OPTIONS="--without-tidy"`. |






TLDR; to solve #198, #72 and #194
This pull request introduces significant improvements to the PHP plugin's development workflow, documentation, and compatibility with modern dependencies. The most notable changes include a complete overhaul of the GitHub Actions CI workflow for better cross-platform and legacy PHP support, new documentation for manual local testing, compatibility patches for ICU 74 and libxml2 2.12, and a script for installing OpenSSL 1.1. Additionally, a new submodule for
php-buildis added to the repository.CI/CD and Development Workflow Improvements
.github/workflows/workflow.ymlto use a single, matrix-based job supporting both Ubuntu and macOS, legacy and modern PHP versions, with improved dependency management and diagnostics. Adds linting and formatting jobs with more robust dependency installation and caching.vendor/php-buildas a submodule, ensuring consistent build tooling. (.gitmodules)Documentation Enhancements
README.mdwith clearer installation, update, and usage instructions for the asdf PHP plugin.docs/local-testing-manually.mdwith detailed, step-by-step guides for installing, uninstalling, and troubleshooting various PHP versions locally, including custom build flags and log monitoring.Compatibility and Build Fixes
patches/php-7.4-icu-74-compat.patch).patches/php-8.0-icu-74-compat.patch).patches/php-8.0-libxml2-2.12-compat.patch).Utility Scripts
lib/install-openssl11.sh, a robust script for building and installing OpenSSL 1.1 locally, with dependency checks, colored output, and instructions for environment configuration.Note
Modernizes the plugin around
php-build, expanding CI/test coverage and improving legacy compatibility.vendor/php-buildsubmodule andbin/post-plugin-addto auto-initialize it; newbin/latest-stablefor resolvinglatestbin/installto drivephp-build, auto-detect/auto-install OpenSSL 1.1 (lib/install-openssl11.sh), set compilers/flags for legacy PHP, install Composer, optional Xdebug, and patch definitions for ICU 74 and libxml2 2.12bin/exec-envto setLD_LIBRARY_PATHfor OpenSSL 1.1 when requiredlintandformatjobspatches/php-7.4-icu-74-compat.patch,patches/php-8.0-icu-74-compat.patch,patches/php-8.0-libxml2-2.12-compat.patchREADME.mdand adddocs/local-testing-manually.md; add.gitmodulesand expand.gitignoreWritten by Cursor Bugbot for commit 3492506. This will update automatically on new commits. Configure here.