Deploy PHP application

That’s a weird one, usually you see that when wanting an amd64 container but running on a arm64 machine (or visa-versa). Is that error message cut off at all? Or is actual: linux the whole thing?

I wonder if max depth exceeded is the true issue tho, that sometimes happens with some unintended recursion (you usually see it when docker-compose.yml is used and tries to name a built image to the same name of an existing image on docker hub). Perhaps your fly.toml config is off.

@fideloper-fly

Here is what my fly.toml file looks like:

# fly.toml app configuration file generated for yova on 2024-02-01T16:31:22Z
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'yova'
primary_region = 'iad'
kill_signal = 'SIGINT'
kill_timeout = '5s'

[experimental]
  auto_rollback = true

[build]
  builder = 'paketobuildpacks/builder-jammy-full'
  buildpacks = ['gcr.io/paketo-buildpacks/php']

[env]
  APP_URL = 'https://yova.fly.dev'
  PORT = '8080'

[[services]]
  protocol = 'tcp'
  internal_port = 8080
  processes = ['app']

[[services.ports]]
    port = 8080
    handlers = ['http']
    force_https = true

[[services.ports]]
    port = 443
    handlers = ['tls', 'http']

  [services.concurrency]
    type = 'connections'
    hard_limit = 25
    soft_limit = 20

[[services.tcp_checks]]
    interval = '15s'
    timeout = '2s'
    grace_period = '1s'

A note to Fly.io staff: I wonder how many Fly.io customers are struggling with PHP buildpack quirks, and if a simpler-to-Dockerize way of running a web server with PHP, such as FrankenPHP (docker docs) would be a better default recommendation. I think that would make for a good blog post on Laravel Bytes if you have anyone available to write up the details such as how to best configure the Caddyfile, etc. Just my 2 cents.

3 Likes

Hey there!

Are you deploying a Laravel app or something else?

We have a lot of tooling around Laravel that can be re-used for other PHP apps, which creates a Dockerfile rather than using a buildpack.

One “hack” to see this is to create an empty artisan file, and running fly launch to see the Dockerfile (etc) that it creates. You might want to do this in a separate branch of your code so you don’t mess up the current (working?) configuration.

You’ll end up (I believe) with a Dockerfile and some files in a .fly directory. It assumes the web root is /var/www/html/public. It also may attempt to run some artisan commands (specific to Laravel) that you can remove in the .fly/scripts directory, and in 2 spots in the generated Dockerfile.

You can review the files created here: flyctl/scanner/templates/laravel at master · superfly/flyctl · GitHub

1 Like

(Also I do have plans to play with FrankenPHP, especially as an Octane driver, but perhaps also as just a general Docker setup on Fly.io)

This is a legacy PHP application. I’m not using Larvel but will try this out and see if there is a migration path forward.

From How To to Questions / Help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.