laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.73k stars 289 forks source link

Octane with FrankenPHP doesn't start when xdebug installed #829

Closed philbates35 closed 6 months ago

philbates35 commented 6 months ago

Octane Version

2.3.1

Laravel Version

10.42.0

PHP Version

8.3

What server type are you using?

FrankenPHP

Server Version

1.0

Database Driver & Version

No response

Description

Octane is immediately being killed when using the FrankenPHP Docker image with xdebug installed. When xdebug isn't installed, everything works fine.

Probably one for @dunglas.

Steps To Reproduce

After cloning this repo (which is basically just a fresh Laravel app) and cp .env.example .env, make the following simple change to Dockerfile:

FROM dunglas/frankenphp:1.0-php8.3

RUN install-php-extensions \
    @composer \
-   pcntl;
+   pcntl \
+   xdebug;

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1

RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini; \
    sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/' $PHP_INI_DIR/php.ini;

ENTRYPOINT ["/bin/sh", "-c" , "composer install && php artisan octane:start --server=frankenphp --host=localhost --port=443 --admin-port=2019 --https"]

Then on the terminal run:

docker-compose up --build
...
php_1  | 91 packages you are using are looking for funding.
php_1  | Use the `composer fund` command to find out more!
php_1  | 
php_1  |    INFO  Server running…
php_1  |   Local: https://localhost:443 
php_1  |   Press Ctrl+C to stop the server
php_1  | 
php_1  | 
php_1  |    WARN  automatic HTTP->HTTPS redirects are disabled
php_1  |    WARN  installing root certificate (you might be prompted for password)
php_1  |    WARN  stapling OCSP
laravel-starter_php_1 exited with code 139

When we don't install xdebug in the Dockerfile though (as is the case on the linked repo), Octane runs indefinitely as expected.

There's nothing in laravel.log so I don't even know where to start debugging this, let me know what you need and I'll be more than happy to help!

driesvints commented 6 months ago

Will let @dunglas reply here

dunglas commented 6 months ago

Unfortunately XDebug isn't supported by static-php-cli (that we use to create the static build of FrankenPHP): https://static-php.dev/en/guide/extension-notes.html#xdebug

You'll have to switch to the Docker image of FrankenPHP (or compile it locally) to use XDebug.

driesvints commented 6 months ago

Thanks @dunglas. Should we add a note about that in the Octane docs maybe?

dunglas commented 6 months ago

@driesvints Yes! I'll document how to use the Docker version and how to add custom extensions.

philbates35 commented 6 months ago

You'll have to switch to the Docker image of FrankenPHP

@dunglas I'm probably misunderstanding, but isn't that what I'm doing here FROM dunglas/frankenphp:1.0-php8.3? My Dockerfile is just extending the official frankenphp docker image, installing a couple of extensions (including xdebug) then running artisan octane:start which sounds like what you're suggesting should work with xdebug?

dunglas commented 6 months ago

@philbates35 Indeed, sorry I read too fast. I'll take a look when I'll be back from vacation!

philbates35 commented 6 months ago

Thanks @dunglas, think it's worth reopening the issue until you've had a look?

dunglas commented 6 months ago

Yes please. It could even be better to open it on FrankenPHP's own repo!