Skip to content

Commit 0185dd5

Browse files
committed
✨ 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 #1208
1 parent c4208ed commit 0185dd5

File tree

31 files changed

+543
-3
lines changed

31 files changed

+543
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"WEB_SERVER": "httpd",
3+
"LIBDIR": "lib"
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
; Custom PHP configuration using #{LIBDIR} placeholder
2+
include_path = ".:/usr/share/php:#{HOME}/#{LIBDIR}"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
phpinfo();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
phpinfo();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ServerRoot "${HOME}/httpd"
2+
Listen ${PORT}
3+
ServerAdmin ${HTTPD_SERVER_ADMIN}
4+
DocumentRoot "${HOME}/@{WEBDIR}"
5+
6+
LoadModule mpm_event_module modules/mod_mpm_event.so
7+
LoadModule unixd_module modules/mod_unixd.so
8+
LoadModule authz_core_module modules/mod_authz_core.so
9+
LoadModule dir_module modules/mod_dir.so
10+
LoadModule mime_module modules/mod_mime.so
11+
LoadModule proxy_module modules/mod_proxy.so
12+
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
13+
LoadModule rewrite_module modules/mod_rewrite.so
14+
15+
<Directory "${HOME}/@{WEBDIR}">
16+
Options Indexes FollowSymLinks
17+
AllowOverride All
18+
Require all granted
19+
</Directory>
20+
21+
DirectoryIndex index.php index.html
22+
TypesConfig conf/mime.types
23+
24+
<FilesMatch \.php$>
25+
SetHandler "proxy:fcgi://@{PHP_FPM_LISTEN}"
26+
</FilesMatch>
27+
28+
ErrorLog logs/error.log
29+
LogLevel warn
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"WEB_SERVER": "httpd",
3+
"WEBDIR": "htdocs"
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
phpinfo();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"WEB_SERVER": "httpd",
3+
"WEBDIR": "public"
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
echo "Custom WEBDIR: public";
3+
phpinfo();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ServerRoot "${HOME}/httpd"
2+
Listen ${PORT}
3+
ServerAdmin #{ADMIN_EMAIL}
4+
DocumentRoot "${HOME}/#{WEBDIR}"
5+
6+
LoadModule mpm_event_module modules/mod_mpm_event.so
7+
LoadModule unixd_module modules/mod_unixd.so
8+
LoadModule authz_core_module modules/mod_authz_core.so
9+
LoadModule dir_module modules/mod_dir.so
10+
LoadModule mime_module modules/mod_mime.so
11+
LoadModule proxy_module modules/mod_proxy.so
12+
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
13+
LoadModule rewrite_module modules/mod_rewrite.so
14+
15+
<Directory "${HOME}/#{WEBDIR}">
16+
Options Indexes FollowSymLinks
17+
AllowOverride All
18+
Require all granted
19+
</Directory>
20+
21+
DirectoryIndex index.php index.html
22+
TypesConfig conf/mime.types
23+
24+
<FilesMatch \.php$>
25+
SetHandler "proxy:fcgi://#{PHP_FPM_LISTEN}"
26+
</FilesMatch>
27+
28+
ErrorLog logs/error.log
29+
LogLevel warn

0 commit comments

Comments
 (0)