php icon indicating copy to clipboard operation
php copied to clipboard

Bug: Fail to run Laravel app on Jammy

Open sophiewigmore opened this issue 2 years ago • 1 comments

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
  1. Run app: docker run --rm -p 8080:8080 --env PORT=8080 jammy-laravel
  2. 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.

sophiewigmore avatar Dec 07 '22 20:12 sophiewigmore

Hi team,

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

pnlinh avatar Dec 26 '23 15:12 pnlinh