Rewrite to be based on php-build#200
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
|
I am currently focused on PHP 8.0.0 installation on macOS |
- Replace all sed 'a' (append) commands with portable awk equivalents - Fixes macOS BSD sed error: 'command a expects \ followed by text' - Remove unused SED_INPLACE variable - Maintain identical patch insertion functionality - Cross-platform compatible (macOS, Linux, BSD)
- Add OS detection for platform-specific build flags - Configure BZip2 and libiconv paths for macOS using Homebrew - Remove incompatible Linux linker flags (--no-as-needed) on macOS - Set proper LDFLAGS and CPPFLAGS for Homebrew library paths - Fixes BZip2 'Please reinstall the BZip2 distribution' error on macOS
|
Excited to finally have asdf (and thus mise) be able to install php properly again. Thanks for your work, looking forward to when this reaches |
|
I am still working on PHP 8.0.0 installation on macOS below is my note for tracking down the issue using 2026 January 24; turns out the error is in php-build, I need to work on php-build first |
|
If I can provide any help, I am happy to help / test on Arch Linux. Just let me know what to do :) |
|
Hi @OliverWich Yes, I would like to have your perspective about these changes on Arch Linux. |
|
One of my PR, php-build/php-build#796 (comment), has been merged and I will add CI for PHP 8.5.2 which released in January 2026 |
Update example PHP version comment to 8.5.4 (2026-04-07) and replace the symlink-based plugin setup with 'asdf plugin add php $(pwd)' to use the current directory
61b7e04 to
509aff4
Compare
Update ext/intl/config.m4 to compile with C++17. ICU 74+ headers use C++17 features (enable_if_t, void_t, is_same_v, if constexpr), so PHP_CXX_COMPILE_STDCXX was bumped from 11 to 17
Add -Wno-int-conversion to CFLAGS for PHP 7.4 and 8.0.x to silence int conversion warnings. Append to PHP_BUILD_CONFIGURE_OPTS and LDFLAGS instead of only setting defaults so existing values are preserved. On macOS enable CXXFLAGS -std=c++17 -stdlib=libc++ -DU_USING_ICU_NAMESPACE and prefer Homebrew's libgd via --with-external-gd when available. Inject an intl C++17 patch into php-build definitions to require C++17 for ext/intl so ICU 74+/78+ headers compile correctly.
There was a problem hiding this comment.
4 issues found across 19 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. 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:46">
P3: Shell prompt prefix in code block makes the command non-copy-pasteable. Remove the prompt prefix so users can copy the command directly.</violation>
</file>
<file name="tests/install_concurrency.bats">
<violation number="1" location="tests/install_concurrency.bats:11">
P2: sed extraction pattern in setup() anchors to comment text that could change independently of the function.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:71">
P2: `asdf set php latest` sets the version in the current directory's `.tool-versions`, NOT globally. Use `asdf set -u php latest` to write to `~/.tool-versions`.</violation>
</file>
<file name="tests/install_dependencies.bats">
<violation number="1" location="tests/install_dependencies.bats:47">
P2: setup() uses sed range patterns to extract functions from bin/install, which breaks if internal whitespace, comment lines, or brace positioning changes. Consider sourcing the whole file and calling functions directly, or refactoring the functions into a separate library file for testing.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
| export TEST_TEMP_DIR="$(mktemp -d)" | ||
|
|
||
| # Extract and source only the target function to avoid install script side effects | ||
| sed -n '/^# php-build does not read ASDF_CONCURRENCY/,/^}$/p' \ |
There was a problem hiding this comment.
P2: sed extraction pattern in setup() anchors to comment text that could change independently of the function.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/install_concurrency.bats, line 11:
<comment>sed extraction pattern in setup() anchors to comment text that could change independently of the function.</comment>
<file context>
@@ -0,0 +1,70 @@
+ export TEST_TEMP_DIR="$(mktemp -d)"
+
+ # Extract and source only the target function to avoid install script side effects
+ sed -n '/^# php-build does not read ASDF_CONCURRENCY/,/^}$/p' \
+ "${PLUGIN_DIR}/bin/install" > "${TEST_TEMP_DIR}/function.sh"
+ source "${TEST_TEMP_DIR}/function.sh"
</file context>
| asdf install php latest | ||
|
|
||
| # Set a version globally (in ~/.tool-versions) | ||
| asdf set php latest |
There was a problem hiding this comment.
P2: asdf set php latest sets the version in the current directory's .tool-versions, NOT globally. Use asdf set -u php latest to write to ~/.tool-versions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 71:
<comment>`asdf set php latest` sets the version in the current directory's `.tool-versions`, NOT globally. Use `asdf set -u php latest` to write to `~/.tool-versions`.</comment>
<file context>
@@ -7,71 +7,191 @@ _Original version of this plugin created by
+asdf install php latest
+
+# Set a version globally (in ~/.tool-versions)
+asdf set php latest
+
+# Or set locally for a project (in ./.tool-versions)
</file context>
| asdf set php latest | |
| asdf set -u php latest |
|
|
||
| # resolve_brew_package_prefix must be sourced before setup_macos_dependencies | ||
| # because setup_macos_dependencies calls it at runtime | ||
| sed -n '/^# Homebrew keg-only packages/,/^}$/p' "${PLUGIN_DIR}/bin/install" > "${TEST_TEMP_DIR}/function.sh" |
There was a problem hiding this comment.
P2: setup() uses sed range patterns to extract functions from bin/install, which breaks if internal whitespace, comment lines, or brace positioning changes. Consider sourcing the whole file and calling functions directly, or refactoring the functions into a separate library file for testing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/install_dependencies.bats, line 47:
<comment>setup() uses sed range patterns to extract functions from bin/install, which breaks if internal whitespace, comment lines, or brace positioning changes. Consider sourcing the whole file and calling functions directly, or refactoring the functions into a separate library file for testing.</comment>
<file context>
@@ -0,0 +1,194 @@
+
+ # resolve_brew_package_prefix must be sourced before setup_macos_dependencies
+ # because setup_macos_dependencies calls it at runtime
+ sed -n '/^# Homebrew keg-only packages/,/^}$/p' "${PLUGIN_DIR}/bin/install" > "${TEST_TEMP_DIR}/function.sh"
+ sed -n '/^# Configure macOS-specific dependencies for all PHP versions$/,/^}$/p' "${PLUGIN_DIR}/bin/install" >> "${TEST_TEMP_DIR}/function.sh"
+ source "${TEST_TEMP_DIR}/function.sh"
</file context>
| asdf plugin remove php | ||
| asdf plugin add php $(pwd) | ||
| asdf install php 8.3.29 | ||
| ➜ ~ asdf set php 8.3.29 |
There was a problem hiding this comment.
P3: Shell prompt prefix in code block makes the command non-copy-pasteable. Remove the prompt prefix so users can copy the command directly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/local-testing-manually.md, line 46:
<comment>Shell prompt prefix in code block makes the command non-copy-pasteable. Remove the prompt prefix so users can copy the command directly.</comment>
<file context>
@@ -0,0 +1,103 @@
+asdf plugin remove php
+asdf plugin add php $(pwd)
+asdf install php 8.3.29
+➜ ~ asdf set php 8.3.29
+# the return should be like
+# ➜ ~ php -v
</file context>
| ➜ ~ asdf set php 8.3.29 | |
| asdf set php 8.3.29 |
69410ef to
7868cbf
Compare



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.