paketo-buildpacks / php

A Cloud Native Buildpack for PHP
Apache License 2.0
25 stars 9 forks source link

Bug: Fail to run Laravel app on Jammy #622

Open sophiewigmore opened 1 year ago

sophiewigmore commented 1 year ago

Expected Behavior

I can run the resulting Laravel app image generating with the buildpacks on the Jammy stack.

Current Behavior

When running docker run --rm -p 8080:8080 --env PORT=8080 jammy-laravel on my app image, it fails when I curl the application:

The stream or file "/workspace/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/workspace/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
...

Possible Solution

This may be resolved by https://github.com/paketo-buildpacks/composer-install/issues/46, but the issue is that we are trying to write to /workspace at run-time which is not allowed due to https://github.com/paketo-buildpacks/rfcs/issues/188. This may not be fixable at all without a workaround, since PHP wants to stream logs

Steps to Reproduce

  1. Generate a Laravel app (composer create-project laravel/laravel ./example-laravel-app), add extensions (fileinfo, curl, openssl) to .php.ini.d/custom.ini
  2. Build:
    pack build jammy-laravel -b paketo-buildpacks/php -e BP_PHP_SERVER=httpd -e BP_PHP_WEB_DIR=public --builder paketobuildpacks/builder-jammy-buildpackless-full
  3. Run app: docker run --rm -p 8080:8080 --env PORT=8080 jammy-laravel
  4. curl localhost:8080

Motivations

Building and reaching a Laravel app with the same steps works on Bionic, but fails on Jammy. Now that we support Jammy Jellyfish with the PHP buildpack, this experience should work.

pnlinh commented 8 months ago

Hi team,

Unfortunately, I also had this problem when build and deployment Laravel 10. Has anyone solved it?