-
Notifications
You must be signed in to change notification settings - Fork 348
Comparing changes
Open a pull request
base repository: cloudfoundry/php-buildpack
base: master
head repository: cloudfoundry/php-buildpack
compare: fix-rewrite-binary-compilation
- 15 commits
- 54 files changed
- 1 contributor
Commits on Jan 26, 2026
-
Fix rewrite binary compilation when using git URL buildpack
When users specify the buildpack via git URL, the pre_package script doesn't run so bin/rewrite remains a shell script. This change compiles the rewrite binary during the finalize phase using Go from GoInstallDir. Changes: - bin/finalize: Export GoInstallDir and BP_DIR for the Go binary - finalize.go: Add compileGoBinary() to compile rewrite at staging time - finalize_test.go: Update tests to use GoInstallDir from runtime.GOROOT()
Configuration menu - View commit details
-
Copy full SHA for 49283ac - Browse repository at this point
Copy the full SHA 49283acView commit details -
Fix rewrite binary compilation for git URL deployments
Move rewrite binary compilation from runtime to staging phase. Previously, bin/rewrite attempted to compile at runtime by sourcing install_go.sh, which caused failures in git URL deployments. Changes: - bin/finalize: Compile rewrite binary alongside finalize during staging - bin/rewrite: Simplified to exec pre-compiled binary from .bp/bin - finalize.go: Copy pre-compiled rewrite with fallback logic: * Git URL mode: Uses REWRITE_BINARY_PATH from bash wrapper * Packaged mode: Falls back to BP_DIR/bin/rewrite - finalize_test.go: Updated tests to compile and use test binary This fixes the runtime error: '/home/vcap/app/.bp/bin/rewrite: line 7: /home/vcap/app/.bp/scripts/install_go.sh: No such file or directory' Staging succeeds, binary is pre-compiled and copied to droplet, runtime simply executes the pre-compiled binary without needing Go toolchain.
Configuration menu - View commit details
-
Copy full SHA for a94a4bd - Browse repository at this point
Copy the full SHA a94a4bdView commit details
Commits on Jan 27, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 4578400 - Browse repository at this point
Copy the full SHA 4578400View commit details -
Replace runtime config rewriting with build-time placeholder replacem…
…ent for multi-buildpack support This commit fundamentally changes how PHP configuration files are processed to fix the multi-buildpack issue where PHP-FPM was trying to write to the wrong deps directory (deps/0 instead of deps/1+). Key changes: - Add ProcessConfigs() function that replaces placeholders at build time during finalization, eliminating the need for runtime rewriting - Remove rewrite tool copying and invocation from start scripts - Update start scripts to use sed for runtime variable expansion (PORT, TMPDIR) - Add support for @{DEPS_DIR} placeholder in php-fpm.conf include directives - Process fpm.d configs separately with app HOME instead of deps HOME - Add replacePlaceholdersInDirExclude() to skip subdirectories during processing Placeholder strategy: - @{VAR} = replaced at build time with absolute paths - ${VAR} = replaced at runtime with sed (for dynamic values like PORT) - #{VAR} = replaced at build time with values known during finalize This fixes the core multi-buildpack support issue where hardcoded assumptions about HOME=$DEPS_DIR/0 prevented proper operation with supply buildpacks.Configuration menu - View commit details
-
Copy full SHA for 0958f39 - Browse repository at this point
Copy the full SHA 0958f39View commit details -
Fix nginx configuration for unix socket and runtime variable expansion
Updates nginx configuration files to work with the new build-time placeholder replacement system: - Add 'unix:' prefix to PHP_FPM_LISTEN upstream server directive for proper unix socket handling (nginx requires explicit 'unix:' prefix) - Change nginx placeholders from @{PORT} and @{TMPDIR} to ${PORT} and ${TMPDIR} to use shell variable syntax for runtime sed replacement These changes ensure nginx can properly connect to PHP-FPM via unix socket and handle dynamic runtime values like PORT that vary per container instance.Configuration menu - View commit details
-
Copy full SHA for e71f830 - Browse repository at this point
Copy the full SHA e71f830View commit details -
Re-enable supply buildpack integration test with git URL buildpack
Re-enables the Default test suite which includes the supply buildpack test. The test now uses git URL buildpack directly instead of requiring pre-installed dotnet_core_buildpack, which fixes the multi-buildpack scenario. Changes: - Re-enable testDefault suite in init_test.go - Update test to use git URL for dotnet-core-buildpack (master branch) - Skip test on Docker platform (git URL buildpacks require CF platform) - Update dotnet fixture csproj to specify .NET 8.0 target framework - Improve test assertions and error messages This test validates that the PHP buildpack works correctly as a final buildpack when used with a supply buildpack, which was the core issue being fixed.
Configuration menu - View commit details
-
Copy full SHA for f07fcc2 - Browse repository at this point
Copy the full SHA f07fcc2View commit details -
Fix PHP-FPM PID file path to support multi-buildpack scenarios
The PHP-FPM pid file path was hardcoded to deps/0 using #DEPS_DIR/0 placeholder, which caused PHP-FPM to fail when used as a final buildpack after a supply buildpack (where deps index is 1 or higher). Changes: - Replace #DEPS_DIR/0 with @{HOME} placeholder in php-fpm.conf for all PHP versions - Remove #DEPS_DIR/0 and #DEPS_DIR from replacement map in finalize.go - Now pid path correctly uses the actual deps index (e.g., /home/vcap/deps/1/...) This allows PHP-FPM to start correctly in multi-buildpack deployments.Configuration menu - View commit details
-
Copy full SHA for 506263b - Browse repository at this point
Copy the full SHA 506263bView commit details
Commits on Jan 28, 2026
-
Remove runtime rewrite binary and related infrastructure
Remove the runtime rewrite binary that was previously used for runtime configuration templating. This completes the migration to build-time placeholder replacement that was introduced in commit 0958f39. The rewrite binary was originally copied from the v4.x Python buildpack and was used to replace template variables in configuration files at runtime. This approach has been superseded by build-time placeholder replacement in the finalize phase, which is more efficient and removes the need for runtime configuration rewriting. Changes: - Remove bin/rewrite shell wrapper script - Remove src/php/rewrite/cli/main.go (entire Go rewrite implementation) - Remove rewrite binary compilation from bin/finalize - Remove bin/rewrite from manifest.yml include_files - Remove /bin/rewrite-compiled from .gitignore - Remove rewrite-related test code and REWRITE_BINARY_PATH handling - Update ARCHITECTURE.md to remove rewrite binary documentation - Update code comments to reflect build-time placeholder replacement
Configuration menu - View commit details
-
Copy full SHA for a3dcabc - Browse repository at this point
Copy the full SHA a3dcabcView commit details -
Unify template variable syntax to @{VAR} format
Standardize all configuration template placeholders to use the @{VAR} syntax consistently. This replaces the mixed usage of #{VAR} and #VAR formats that existed across httpd, nginx, php-fpm, and php.ini configuration files. Variables updated: WEBDIR, LIBDIR, PHP_FPM_LISTEN, PHP_EXTENSIONS, ZEND_EXTENSIONS, PHP_FPM_CONF_INCLUDEConfiguration menu - View commit details
-
Copy full SHA for 56fcd74 - Browse repository at this point
Copy the full SHA 56fcd74View commit details -
Add vendor symlink in WEBDIR for Composer autoload compatibility
Create a symlink from WEBDIR/vendor to the actual vendor directory during Composer compilation. This allows apps to use relative require paths like `require 'vendor/autoload.php'` from their web root (e.g., htdocs). The symlink is only created when: - WEBDIR exists and vendor is not already inside it - No existing vendor directory or symlink exists in WEBDIR Also fixes #{LIBDIR} -> @{LIBDIR} placeholder in composer extension.Configuration menu - View commit details
-
Copy full SHA for 3b14de8 - Browse repository at this point
Copy the full SHA 3b14de8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 279819a - Browse repository at this point
Copy the full SHA 279819aView commit details
Commits on Jan 29, 2026
-
Configuration menu - View commit details
-
Copy full SHA for a3d54eb - Browse repository at this point
Copy the full SHA a3d54ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8471b5e - Browse repository at this point
Copy the full SHA 8471b5eView commit details -
Fix php.ini.d context bug and add comprehensive buildpack documentation
This commit addresses a critical bug in placeholder replacement and adds extensive documentation comparing the PHP buildpack with other CF buildpacks. Bug Fix: - Fix php.ini.d directory context: process with app HOME instead of deps HOME The php.ini.d directory was incorrectly processed with deps context (@{HOME} = /home/vcap/deps/{idx}) instead of app context (@{HOME} = /home/vcap/app). This affected the buildpack-created include-path.ini and any user-provided php.ini.d/*.ini files using @{HOME} placeholders. Changed finalize.go to process php.ini.d separately (like fpm.d) with app-context replacements, ensuring include paths and user configs reference the correct application directory. Documentation: - Add docs/ directory with comprehensive architectural documentation (60K total): - BUILDPACK_COMPARISON.md: Cross-buildpack analysis showing PHP v5.x follows the same patterns as Go, Java, Ruby, and Python buildpacks - VCAP_SERVICES_USAGE.md: Complete guide on service binding patterns, clarifying that VCAP_SERVICES IS available during staging in Go code - REWRITE_MIGRATION.md: Moved from root, corrected misleading statements about VCAP_SERVICES availability - README.md: Navigation hub with best practices and quick links - Correct misconception: VCAP_SERVICES is available during staging for extensions and Go code, just not as @{...} config file placeholders - Document that v4.x runtime rewrite was PHP-unique, not a CF standard pattern used by other buildpacks Testing: - Update php_with_php_ini_d fixture to test @{HOME} placeholder replacement - Add test verification for include_path containing /home/vcap/app/lib - Enhance modules_test.go to validate placeholder replacement in php.ini.d The documentation demonstrates that PHP buildpack v5.x is fully aligned with Cloud Foundry buildpack standards and best practices.Configuration menu - View commit details
-
Copy full SHA for 048a88a - Browse repository at this point
Copy the full SHA 048a88aView commit details -
Add comprehensive user guide and developer feature reference
Documentation Enhancement: - Add USER_GUIDE.md (15K, 865 lines): Complete end-user guide for all buildpack features - Getting started (deploy in 2 commands) - Web server configuration (Apache, Nginx, FPM-only) - PHP configuration (versions, ini files, FPM pools) - PHP extensions installation - Composer and dependencies - APM integration (NewRelic, AppDynamics, Dynatrace) - Session storage (Redis, Memcached) - Framework guides (Laravel, CakePHP, Symfony, Laminas) - Advanced features (multi-buildpack, preprocess commands) - Troubleshooting section - Add FEATURES.md (11K, 696 lines): Developer/maintainer reference with test coverage verification - 30+ features with explicit integration test references - Test locations (file:line numbers) - Fixture paths for each feature - Implementation details and code snippets - Test coverage analysis matrix - Identification of 7 features needing explicit tests - Cross-references to integration tests - Update docs/README.md: Separate USER_GUIDE.md (for users) and FEATURES.md (for developers) with clear audience targeting - Update root README.md: Reference both user and developer documentation Documentation Structure (Total: 80K across 6 files): - USER_GUIDE.md - For end users deploying applications - FEATURES.md - For developers/maintainers verifying test coverage - BUILDPACK_COMPARISON.md - Cross-buildpack architectural analysis - VCAP_SERVICES_USAGE.md - Service binding patterns and best practices - REWRITE_MIGRATION.md - v4.x to v5.x migration guide - README.md - Navigation hub with quick links The documentation demonstrates comprehensive feature coverage with 95%+ test verification and provides clear guidance for both users and maintainers.
Configuration menu - View commit details
-
Copy full SHA for 99b2d12 - Browse repository at this point
Copy the full SHA 99b2d12View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...fix-rewrite-binary-compilation