dunglas / frankenphp

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

can't run worker mode on laravel #797

Closed Fliw closed 5 months ago

Fliw commented 5 months ago

What happened?

Hey, thanks for creating this, i've installed franken php on my root directory, i'm using this repo to set frankenphp on my laravel https://github.com/Kamleshpaul/setup-laravel-with-frankenphp,

this is the mechanism :

  1. Nginx is port forwarding 80 / 443 to 69, i still need Nginx as my default webserver, however it works, i can access my laravel by port forwarding, when i use php info it says my SAPI is FrankenPHP
  2. i have created Caddyfile and modify as below :
    
    {
      frankenphp
      order php_server before file_server
      auto_https off
    }

http://myweb.com:69 { root * public/ encode zstd gzip php_server { resolve_root_symlink worker { num_workers 2 max_request 500 } } }

3. i'm try to run with command ./frankenphp run and it works, however i don't think it uses a worker
4. so i'm decided to run with ./frankenphp php_server --domain http://myweb.com:69 and it return `Error: loading new config: http app module: start: listening on :443: listen tcp :443: bind: address already in use`
5. im already force the https off because i've self-signed certificate in my nginx, and it works without the worker mode
6. i've run ./frankenphp run --worker and it says `unknown flag: --worker`

so, what must i do to solve this and use worker mode?

in simple terms: how to run ./frankenphp run with worker flag

### Build Type

Standalone binary

### Worker Mode

Yes

### Operating System

GNU/Linux

### CPU Architecture

x86_64

### PHP configuration

```shell
'./configure' '--prefix=' '--with-valgrind=no' '--enable-shared=no' '--enable-static=yes' '--disable-all' '--disable-cgi' '--disable-phpdbg' '--disable-cli' '--disable-fpm' '--enable-embed=static' '--disable-micro' '--disable-opcache-jit' '--enable-zts' '--disable-zend-signals' '--enable-zend-max-execution-timers' '--enable-apcu' '--enable-bcmath' '--with-bz2=/go/src/app/dist/static-php-cli/buildroot' '--enable-calendar' '--enable-ctype' '--with-curl' '--enable-dba' '--enable-dom' '--enable-exif' '--enable-fileinfo' '--enable-filter' '--with-zlib' '--with-zlib-dir=/go/src/app/dist/static-php-cli/buildroot' '--enable-gd' '--with-freetype' '--with-jpeg' '--with-webp' '--with-avif' '--with-iconv=/go/src/app/dist/static-php-cli/buildroot' '--enable-igbinary' '--enable-intl' '--with-openssl=/go/src/app/dist/static-php-cli/buildroot' '--with-openssl-dir=/go/src/app/dist/static-php-cli/buildroot' '--with-ldap=/go/src/app/dist/static-php-cli/buildroot' '--enable-mbstring' '--enable-mysqlnd' '--with-mysqli' '--enable-opcache' '--enable-pcntl' '--enable-pdo' '--with-pdo-mysql' '--with-pgsql=/go/src/app/dist/static-php-cli/buildroot' '--with-pdo-pgsql=/go/src/app/dist/static-php-cli/buildroot' '--with-sqlite3=/go/src/app/dist/static-php-cli/buildroot' '--with-pdo-sqlite' '--enable-phar' '--enable-posix' '--with-readline=/go/src/app/dist/static-php-cli/buildroot' '--enable-session' '--enable-redis' '--enable-redis-session' '--enable-redis-igbinary' '--enable-redis-lz4' '--with-liblz4=/go/src/app/dist/static-php-cli/buildroot' '--enable-simplexml' '--enable-sockets' '--with-sodium' '--enable-sysvsem' '--enable-tokenizer' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-libxml=/go/src/app/dist/static-php-cli/buildroot' '--with-zip=/go/src/app/dist/static-php-cli/buildroot' 'CFLAGS=' 'PKG_CONFIG=/go/src/app/dist/static-php-cli/buildroot/bin/pkg-config' 'PKG_CONFIG_PATH=/go/src/app/dist/static-php-cli/buildroot/lib/pkgconfig'

Relevant log output

No response

Fliw commented 5 months ago

update: So, i've read the documentation and found how to configure worker, so i've change my Caddyfile like this in my laravel app

{
      frankenphp
      order php_server before file_server
      auto_https off
      frankenphp {
            worker public/index.php 2
      }
}

http://myweb.com:69 {
      root * public/
      encode zstd gzip
      php_server {
            resolve_root_symlink

      }
}

when i start the ./frankenphp run, it goes like this

image

until it exit automatically, any help?

withinboredom commented 5 months ago

any help?

Your worker is exiting, causing it to restart, most likely. You don't include enough information to really be able to help out here.

Fliw commented 5 months ago

hi, thankyou for helping, BTW i've solved this issue by using laravel octane and not standalone library, it works like a charm 🪄

nguyenthehiepsi commented 2 months ago

hi, thankyou for helping, BTW i've solved this issue by using laravel octane and not standalone library, it works like a charm 🪄

Can you share what you had done? Dont tell me that you only installed laravel octane? I have the same errors while laravel octane is installed, the fact that i wanna clarify config as much as possible and also wanna set worker