Commit Graph

125 Commits

Author SHA1 Message Date
Kévin Dunglas
2af8fd2e31 chore: remove useless cgo directive 2024-08-06 22:57:04 +02:00
Kévin Dunglas
0500ebc191 perf: improve PHP thread management (#898) 2024-07-09 09:39:03 +02:00
Kévin Dunglas
3714fdf3a1 fix: superglobals-realated crash with custom extensions in worker mode (#796)
* test: failing test reproducing #767

* fix

* Update frankenphp.c

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

* Update frankenphp.c

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

* review

* ZVAL_COPY

* fix

* add back current $_SERVER behavior

* add docs

* bad fix for the leak

* clean test

* improve tests

* fix test

* fix

* cleanup

* clarify destroy super globals name

* micro-optim: use zval_ptr_dtor_nogc to destroy super globals

* style

* fix

* better name for frankenphp_free_server_context

* more cleanup

* remove useless memset

* more cleanup

* continue refactoring

* fix and update docs

* docs

---------

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2024-06-05 15:24:16 +02:00
Rob Landers
b96db939b7 feat: option to enable full duplex for HTTP/1 connections (#692)
* found another spot that was preventing http1 writes

* remove full-duplex from caddyfile

* update documentation

* fix: update http name

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* fix: update http name

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* fix: names

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* fix: update caddyfile name

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Add caution to docs

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update config.md

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* fix lint

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2024-05-31 14:38:31 +02:00
Kévin Dunglas
90a7b98b10 feat: log the number of threads and workers during startup 2024-05-30 11:15:30 +02:00
Rob Landers
d973206174 fix reading post bodies (#686)
Now that https://github.com/golang/go/issues/15527 is supposedly fixed, this condition should be no-longer needed. Further, if php didn't request enough bytes, this condition would be hit. It appears PHP requests chunks ~2mb in size at a time.
2024-03-24 12:18:46 +01:00
Kévin Dunglas
1511decad6 chore: some CS changes 2024-03-12 22:20:04 +01:00
Kévin Dunglas
07a74e5c5a perf: reduce allocs when creating $_SERVER (#540)
* perf: reduce allocs when creating $_SERVER

* improve

* refactor: prevent C allocs when populating $_SERVER

* cs

* remove append()

* simplify

* wip

* cleanup

* add cache

* cleanup otter init

* some fixes

* cleanup

* test with a leak

* remove const?

* add const

* wip

* wip

* allocate dynamic variables in Go memory

* cleanup

* typo

* bump otter

* chore: bump deps
2024-03-12 18:31:30 +01:00
Kévin Dunglas
b71dae9b03 fix: prevent crash when calling apache_request_headers() in non-HTTP context 2024-02-27 17:51:10 +01:00
Kévin Dunglas
fe7e9e7c79 fix: crash when using apache_request_headers() (#536)
* fix: potential crash when using apache_request_headers()

* refactor: better apache_request_headers
2024-02-01 10:00:11 +01:00
Kévin Dunglas
49baf02035 feat: add go_apache_request_headers() 2024-01-23 23:14:24 +01:00
naoki kuroda
3692818d0c perf: optimize cookie handling in request (#459)
Signed-off-by: nnnkkk7 <kurodanaoki0711pana@gmail.com>
2024-01-08 08:14:49 +01:00
Rob Landers
7830aae549 Ensure we don't modify a shared env (#452)
* Ensure we don't modify a shared env

* Update worker.go

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update worker.go

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2023-12-31 20:02:11 +01:00
Rob Landers
2055142904 apply just an optimization (#450) 2023-12-30 11:21:21 +01:00
Rob Landers
5bda50cbd7 Fix memory leak (#442)
* do not use caddy context

* ensure all handles are cleaned up

* do not export types

* just panic when double deleting a handle

* set the minimal capacity

* remove micro-opt

* move handle cleanup to just before we return from serveHttp

* ensure we clean up cli scripts

* handle cgi-mode free

* micro-optimization: set initial capacity
2023-12-28 00:16:19 +01:00
Kévin Dunglas
7c5f18fe3f ci: fix changelog generation 2023-12-19 14:20:34 +01:00
Kévin Dunglas
3709c2a50b chore: switch to upstream C-Thread-Pool 2023-12-18 18:50:50 +01:00
Kévin Dunglas
6509cddd2a feat: embed PHP apps into the FrankenPHP binary 2023-12-02 15:40:51 +01:00
Shyim
bb931c99ff remove sqlite3 requirement on darwin, fixes #330 2023-12-02 15:40:37 +01:00
Kévin Dunglas
b4aa8038ff feat: detect when worker crashes or terminates normally (#315) 2023-11-21 23:15:07 +01:00
Kévin Dunglas
aa1d968dcf refactor: faster $_SERVER variables creation 2023-11-16 14:40:52 +01:00
Kévin Dunglas
4d2cd5f715 perf: write the response body directly from the memory allocated by PHP 2023-11-07 08:34:18 +01:00
Kévin Dunglas
a4938102e1 perf: read the request body directly in the memory allocated by PHP 2023-11-07 08:34:04 +01:00
Kévin Dunglas
120006a297 chore: bump deps 2023-10-16 21:53:18 +02:00
Kévin Dunglas
ec35afdc7f chore: remove C-Thread-Pool/example.c (#259) 2023-10-10 15:26:03 +02:00
Kévin Dunglas
c615fe0087 feat: add experimental CLI support (#239)
* feat: add CLI support

* updated

* debug

* fix tests

* Caddy php-cli command

* use thread

* $_SERVER and input streams support

* Update frankenphp.c

Co-authored-by: Francis Lavoie <lavofr@gmail.com>

---------

Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2023-10-09 14:38:15 +02:00
shangyuanchun
52caf17a40 fix: to solve php versions like: 9.0 / 9.1 2023-10-09 09:23:50 +02:00
Kévin Dunglas
e193a374d3 freat: set thread name to frankenphp 2023-10-06 19:15:04 +02:00
Kévin Dunglas
1f3007337d feat: create a static build of FrankenPHP (#198)
* ci: create a static build of FrankenPHP

* try to use alpine

* path mapping

* cache and fixes

* fix

* fix include path

* fix include path

* fix include path

* switch to Docker

* fix github token

* cleanup

* various improvements

* macOS instructions

* fix GHA

* docs

* feat: mac static builds

* minor fix

* fix wd

* Apple silicon build

* Revert "Apple silicon build"

This reverts commit 7a2997e092.

* add opcache

* update builder

* upgrade to PHP 8.2

* switch to upstream static-php-cli, add intl
2023-09-12 22:08:19 +02:00
Kévin Dunglas
f5b599bc2b fix: superfluous response.WriteHeader call 2023-08-24 12:23:59 +02:00
Kévin Dunglas
ab0783519e perf: reduce the number of calls to cgo to set the headers 2023-08-18 19:20:32 +02:00
Kévin Dunglas
e65fdfff2f chore: better cgo directives 2023-08-18 18:21:21 +02:00
Kévin Dunglas
e0f2323bf6 fix : make sure the PHP request body buffer is full before giving it back (#187)
* test: large requests with Caddy

* fix: ensure that the request body buffer is full

* refactor: microoptim
2023-08-16 17:52:29 +02:00
Kévin Dunglas
2dbc94508c chore: better Zend Max Execution Timers message 2023-08-12 21:26:47 +02:00
Kévin Dunglas
027cdc7b40 fix: flush support with Caddy 2.7 2023-08-12 21:25:45 +02:00
Kévin Dunglas
307c5fa865 fix: properly cleanup workersReadyWG (#184) 2023-08-12 12:39:13 +02:00
Kévin Dunglas
b03ce0eb20 fix: don't abort con when streaming not possible 2023-08-08 15:28:56 +02:00
Kévin Dunglas
df976c1708 fix: race condition on shutdown 2023-08-06 17:37:52 +02:00
Kévin Dunglas
671fda9e29 feat: honor GOMAXPROCS and set it automatically in containers 2023-08-06 15:25:31 +02:00
Kévin Dunglas
6c215b8b10 feat: increase the default number of workers 2023-07-17 11:40:37 +02:00
DracoBlue
c8237554e2 The configuration to enable ZendMaxExecutionTimers is --enable-zend-max-execution-timers (#145) 2023-03-19 14:14:46 +01:00
Kévin Dunglas
75cd310292 feat: add support for PHP timeouts on Linux (#128) 2023-03-05 15:47:20 +01:00
Kévin Dunglas
e514823faa fix: use SA_ONSTACK in C-Thread-Pool 2022-12-20 10:24:34 +01:00
Kévin Dunglas
4332bbe97c fix: don't flush if the request body hasn't been read entirely (#122) 2022-12-13 20:21:47 +01:00
Kévin Dunglas
0ea179d402 fix: set the _GNU_SOURCE macro to allow memrchr usage (#124)
* fix: set the _GNU_SOURCE macro to allow memrchr usage

* only on Linux

* add -Werror to prevent future issues like this
2022-12-13 00:39:18 +01:00
Kévin Dunglas
2937aa8047 fix: panic: http: invalid Read on closed Body (#121) 2022-12-07 14:40:17 +01:00
Kévin Dunglas
229b4d6786 chore: switch back to upstream C-Thread-Pool lib (#119) 2022-12-03 17:00:53 +01:00
Kévin Dunglas
8e824a7906 perf: remove an extra call to cgo (#117) 2022-11-28 18:06:37 +01:00
Kévin Dunglas
878a30d92f fix: ensure there is always a free thread for non-worker scripts (#105) 2022-11-14 22:45:51 +01:00
Kévin Dunglas
6a6dda5ed9 feat: expose PHP version (#102) 2022-11-12 14:48:10 +01:00