dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.8k stars 233 forks source link

Is worker mode broken??? #100

Closed withinboredom closed 1 year ago

withinboredom commented 1 year ago

PHP file

// public/worker.php
<?php

do {
    $running = frankenphp_handle_request(
        function () {
            echo "hello world";
        }
    );
} while ($running);

Then:

docker run --rm -e FRANKENPHP_CONFIG="worker ./public/worker.php" -p 80:80 -p 443:443 -v $(pwd):/app -w /app dunglas/frankenphp

When I curl localhost, it just hangs forever. @dunglas, can you reproduce this or am I doing something wrong?

dunglas commented 1 year ago

No issue on my side with the latest version of the image:

docker pull dunglas/frankenphp
docker run --rm -e FRANKENPHP_CONFIG="worker ./public/worker.php" -p 80:80 -p 443:443 -v $(pwd):/app -w /app dunglas/frankenphp
image
withinboredom commented 1 year ago

aha, I was missing the worker.php part. I thought worker ./public/worker.php implied it was to run worker.php for every request.

dunglas commented 1 year ago

Ok got it! So there is a bug: a 404 should be thrown, the server should not hang.