-
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: remove-rewrite-binary-clean
- 7 commits
- 91 files changed
- 1 contributor
Commits on Jan 29, 2026
-
Remove runtime rewrite binary and fix php.ini.d context
This commit removes the runtime rewrite binary and replaces it with build-time placeholder replacement, fixing multiple issues with multi-buildpack deployments and git URL buildpack usage. It also fixes a critical bug where php.ini.d configs were processed with the wrong HOME context. ## Rewrite Binary Removal The rewrite binary was originally copied from the v4.x Python buildpack and used to replace template variables in configuration files at runtime. This approach had several issues: - Failed when buildpack was deployed via git URL - Compilation errors in multi-buildpack scenarios - Security concerns with runtime config rewriting - Performance overhead at container startup This commit completes the migration to build-time placeholder replacement that provides better security, performance, and multi-buildpack compatibility. ### Changes: - Remove bin/rewrite shell wrapper script - Remove src/php/rewrite/cli/main.go (entire rewrite implementation) - Remove rewrite binary compilation from bin/finalize - Remove bin/rewrite from manifest.yml include_files - Remove /bin/rewrite-compiled from .gitignore - Update ARCHITECTURE.md to remove rewrite binary documentation ## Build-Time Placeholder Replacement Add ProcessConfigs() method to finalize phase that replaces @{VAR} placeholders with actual values during staging: - @{HOME} - App or dependency directory path - @{DEPS_DIR} - Dependencies directory (/home/vcap/deps) - @{WEBDIR} - Web document root (default: htdocs) - @{LIBDIR} - Library directory (default: lib) - @{PHP_FPM_LISTEN} - PHP-FPM socket/TCP address - @{TMPDIR} - Converted to ${TMPDIR} for runtime expansion - @{PHP_EXTENSIONS} - Extension directives - @{ZEND_EXTENSIONS} - Zend extension directives ## Placeholder Syntax Unification Unify all template variables to use @{VAR} syntax consistently across all config files (httpd, nginx, php-fpm, php.ini). ## Multi-Buildpack Fixes - Fix PHP-FPM PID file path to use deps directory for multi-buildpack scenarios - Fix nginx configuration for Unix socket and runtime variable expansion - Update supply buildpack integration tests ## php.ini.d Context Bug Fix Fix critical bug where php.ini.d directory was processed with deps context (@{HOME} = /home/vcap/deps/{idx}) instead of app context (@{HOME} = /home/vcap/app). The php.ini.d directory contains user-provided PHP configurations that typically reference application paths (include_path, open_basedir, etc.), similar to fpm.d configs. Processing with deps context caused the buildpack-created include-path.ini and user configs to reference incorrect paths. ### Changes: - Process php.ini.d separately (like fpm.d) with app-context replacements - Update supply.go comments to clarify php.ini.d context behavior - Add fixture test for @{HOME} placeholder in php.ini.d configs - Enhance modules integration test to verify placeholder replacement Both fpm.d and php.ini.d now use app HOME context while other PHP configs (php.ini, php-fpm.conf) use deps HOME context. Fixes issues with: - Buildpack-created include-path.ini referencing wrong directory - User-provided php.ini.d configs using @{HOME} placeholders - Include paths not resolving to application lib directoryConfiguration menu - View commit details
-
Copy full SHA for 929020d - Browse repository at this point
Copy the full SHA 929020dView 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 (e.g., htdocs directory) - Vendor directory is not already inside WEBDIR - No existing vendor directory or symlink exists in WEBDIR - Actual vendor directory exists after Composer installation Example: If composer.json specifies vendor-dir as "lib/vendor" and WEBDIR is "htdocs", this creates htdocs/vendor -> ../lib/vendor This maintains backward compatibility for apps that reference vendor/autoload.php from their web-accessible directory while keeping the actual vendor directory outside the web root for security. Also fixes placeholder syntax: #{LIBDIR} -> @{LIBDIR} to match the unified @{VAR} syntax used throughout the buildpack.Configuration menu - View commit details
-
Copy full SHA for a2e6593 - Browse repository at this point
Copy the full SHA a2e6593View commit details -
Improve test infrastructure and cleanup
This commit improves the integration test infrastructure with better cleanup, more robust regex matching, and proper handling of unsupported features. Changes: - Fix integration test regex patterns for more reliable matching - Skip custom extensions test (feature not yet supported in v5.x) - Cleanup buildpack files after integration tests to prevent disk space issues Test Infrastructure Improvements: - Add buildpack cleanup in init_test.go to remove uploaded buildpacks after tests - Refactor default_test.go regex patterns for better readability - Add explicit skip for custom extensions with clear explanation These changes improve test reliability and reduce CI/CD resource usage by properly cleaning up test artifacts.
Configuration menu - View commit details
-
Copy full SHA for 13f0fd5 - Browse repository at this point
Copy the full SHA 13f0fd5View commit details -
Add comprehensive buildpack documentation
Add 80K of comprehensive documentation covering architecture, features, migration, and service binding patterns for both end users and developers/maintainers. Documentation Structure: - docs/USER_GUIDE.md (15K, 865 lines) - Complete end-user guide - docs/FEATURES.md (11K, 696 lines) - Developer reference with test coverage - docs/BUILDPACK_COMPARISON.md (12K) - Cross-buildpack architectural analysis - docs/VCAP_SERVICES_USAGE.md (12K) - Service binding patterns and best practices - docs/REWRITE_MIGRATION.md (27K) - v4.x to v5.x migration guide - docs/README.md (7K) - Navigation hub with best practices USER_GUIDE.md (For End Users): - 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 dependency management - APM integration (NewRelic, AppDynamics, Dynatrace) - Session storage (Redis, Memcached) - Framework guides (Laravel, CakePHP, Symfony, Laminas) - Advanced features (multi-buildpack, preprocess commands) - Troubleshooting section FEATURES.md (For Developers/Maintainers): - 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 features needing explicit tests - Cross-references to integration tests BUILDPACK_COMPARISON.md: - Proves PHP v5.x follows same patterns as Go, Java, Ruby, Python buildpacks - Documents VCAP_SERVICES availability during staging - Explains why v4.x runtime rewrite was PHP-unique, not a CF standard - Shows alignment with Cloud Foundry buildpack ecosystem VCAP_SERVICES_USAGE.md: - Clarifies VCAP_SERVICES IS available during staging (for extensions and Go code) - Documents that @{VCAP_SERVICES} config file placeholders are not supported - Provides service binding patterns and examples - Migration strategies from v4.x - Best practices and anti-patterns REWRITE_MIGRATION.md: - Comprehensive v4.x to v5.x migration guide - Breaking changes in rewrite system - Placeholder syntax changes - User-provided config handling - Corrects misconceptions about VCAP_SERVICES availability Key Documentation Insights: - VCAP_SERVICES IS available during staging in Go code (not just runtime) - PHP v5.x aligns with all other CF buildpacks (Go, Java, Ruby, Python) - v4.x runtime rewrite was PHP-unique, removed for CF standards alignment - 95%+ test coverage verification for documented features - Separate docs for end users vs developers/maintainers The documentation demonstrates comprehensive feature coverage and provides clear guidance for both buildpack users and maintainers.Configuration menu - View commit details
-
Copy full SHA for c4208ed - Browse repository at this point
Copy the full SHA c4208edView commit details
Commits on Feb 9, 2026
-
✨ feat: add PHP version placeholder resolution and #{VAR} syntax support
- Add {PHP_XX_LATEST} placeholder resolution in options.json - Resolves {PHP_83_LATEST}, {PHP_82_LATEST}, {PHP_81_LATEST} to actual versions - Provides clear error messages for invalid placeholders - Add #{VAR} placeholder syntax for backward compatibility with v4.x - Support both @{VAR} and #{VAR} syntax in all config files - Restore compatibility for users migrating from v4.x buildpack - Add comprehensive integration tests - 10 test cases covering placeholder resolution - Test fixtures for all scenarios - Unit tests for both features Fixes #1208Configuration menu - View commit details
-
Copy full SHA for 0185dd5 - Browse repository at this point
Copy the full SHA 0185dd5View commit details
Commits on Feb 15, 2026
-
✨ feat: implement ADDITIONAL_PREPROCESS_CMDS with v4.x compatibility …
…and security warnings
Configuration menu - View commit details
-
Copy full SHA for 441644a - Browse repository at this point
Copy the full SHA 441644aView commit details -
Configuration menu - View commit details
-
Copy full SHA for aace507 - Browse repository at this point
Copy the full SHA aace507View 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...remove-rewrite-binary-clean