Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/php/extensions/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ type PHPConfigHelper struct {

// NewPHPConfigHelper creates a new PHP config helper
func NewPHPConfigHelper(ctx *Context) *PHPConfigHelper {
// PHP is installed into the dependency directory, and ctx.BuildDir is empty
// during staging because BUILD_DIR is not exported to the buildpack. The
// supply phase records the real path under the DEPS_DIR key instead.
phpEtcDir := filepath.Join(ctx.GetString("DEPS_DIR"), "php", "etc")

return &PHPConfigHelper{
ctx: ctx,
phpIniPath: filepath.Join(ctx.BuildDir, "php", "etc", "php.ini"),
phpFpmPath: filepath.Join(ctx.BuildDir, "php", "etc", "php-fpm.conf"),
phpIniPath: filepath.Join(phpEtcDir, "php.ini"),
phpFpmPath: filepath.Join(phpEtcDir, "php-fpm.conf"),
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/php/extensions/sessions/sessions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ import (

var _ = Describe("SessionsExtension", func() {
var (
ext *sessions.SessionsExtension
ctx *extensions.Context
err error
buildDir string
ext *sessions.SessionsExtension
ctx *extensions.Context
err error
depsDir string
)

BeforeEach(func() {
ext = &sessions.SessionsExtension{}
ctx, err = extensions.NewContext()
Expect(err).NotTo(HaveOccurred())

// Create temp build directory for file operations
buildDir, err = os.MkdirTemp("", "sessions-test")
// PHP is installed into the dependency directory, which is where the
// supply phase records DEPS_DIR and writes php.ini.
depsDir, err = os.MkdirTemp("", "sessions-test")
Expect(err).NotTo(HaveOccurred())

// Set BuildDir directly on the struct field (not via Set() which uses Data map)
ctx.BuildDir = buildDir
ctx.Set("DEPS_DIR", depsDir)
ctx.Set("BP_DIR", "/tmp/bp")
})

AfterEach(func() {
if buildDir != "" {
os.RemoveAll(buildDir)
if depsDir != "" {
os.RemoveAll(depsDir)
}
})

Expand Down Expand Up @@ -213,7 +213,7 @@ var _ = Describe("SessionsExtension", func() {
var phpDir string

BeforeEach(func() {
phpDir = filepath.Join(buildDir, "php")
phpDir = filepath.Join(depsDir, "php")
err := os.MkdirAll(filepath.Join(phpDir, "etc"), 0755)
Expect(err).NotTo(HaveOccurred())

Expand Down
Loading