FS#73470 - [uwsgi-plugin-php] completly broken with php 8.1
Attached to Project:
Community Packages
Opened by Damjan Georgievski (damjan) - Sunday, 23 January 2022, 12:54 GMT
Last edited by David Runge (dvzrv) - Tuesday, 01 February 2022, 09:08 GMT
Opened by Damjan Georgievski (damjan) - Sunday, 23 January 2022, 12:54 GMT
Last edited by David Runge (dvzrv) - Tuesday, 01 February 2022, 09:08 GMT
|
Details
''$ cat /srv/http/index.php''
<code> <?php phpinfo(); </code> ''$ uwsgi --plugin 0:php --http-socket :8081 --php-docroot /srv/http/ --php-index index.php'' <code> *** Starting uWSGI 2.0.20 (64bit) on [Sun Jan 23 13:41:22 2022] *** compiled with version: 11.1.0 on 04 January 2022 18:16:08 os: Linux-5.16.2-arch1-1 #1 SMP PREEMPT Thu, 20 Jan 2022 16:18:29 +0000 nodename: archless machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 12 current working directory: /home/damjan detected binary path: /usr/bin/uwsgi *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 111738 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address :8081 fd 3 PHP document root set to /srv/http PHP Warning: Missing arginfo for uwsgi_version() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_setprocname() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_worker_id() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_masterpid() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_signal() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_rpc() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_get() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_set() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_update() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_del() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_clear() in Unknown on line 0 PHP Warning: Missing arginfo for uwsgi_cache_exists() in Unknown on line 0 PHP 8.1.1 initialized your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72920 bytes (71 KB) for 1 cores *** Operational MODE: single process *** *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 49992, cores: 1) PHP Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0 PHP Fatal error: Failed opening required ' ' (include_path='.:') in Unknown on line 0 [pid: 49992|app: -1|req: -1/1] 192.168.17.225 () {32 vars in 532 bytes} [Sun Jan 23 13:41:34 2022] GET / => generated 0 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 103 bytes (0 switches on core 0) [pid: 49992|app: -1|req: -1/2] 192.168.17.225 () {32 vars in 496 bytes} [Sun Jan 23 13:41:34 2022] GET /favicon.ico => generated 9 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 71 bytes (0 switches on core 0) PHP Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0 PHP Fatal error: Failed opening required ' ' (include_path='.:') in Unknown on line 0 [pid: 49992|app: -1|req: -1/3] 192.168.17.225 () {32 vars in 550 bytes} [Sun Jan 23 13:41:49 2022] GET /index.php => generated 0 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 103 bytes (0 switches on core 0) </code> everything identical but with php7 (''--plugin 0:php7'') works just fine (and it worked with php 8.0). |
This task depends upon
Closed by David Runge (dvzrv)
Tuesday, 01 February 2022, 09:08 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed with uwsgi-plugin-php 2.0.20-5
Tuesday, 01 February 2022, 09:08 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed with uwsgi-plugin-php 2.0.20-5
I still fails with the "file not found" error.
EDIT: Very strange. It looks for a file called "hp" in your doc root. If you create such file its content gets executed. I suggest to report it upstream.
Fixing this in a live environment is messy and leads to developer burnout.
It seems the upstream project does not actively track PHP development. While it's great they do CI testing they only run tests on various Python versions: https://github.com/unbit/uwsgi/blob/master/.github/workflows/test.yml There is a compile test (which would not have found this issue) that only checks against PHP 7.2: https://github.com/unbit/uwsgi/blob/master/.github/workflows/compile-test.yml (7.2 is end of live since November 2020)
The issue is they use char instead of zend_string for real_filename?
I am not sure, but it looks as if that might lead to an issue such as this, where filenames are weirdly truncated.
If you have a clue how to fix that for the upstream codebase, I'm sure they'd be happy about contributions.
Upstream certainly needs to invest time into automated tests and development of various plugins.
Given that we have close to no documentation on using e.g. php-fpm it's also not super easy to just point at this as a replacement for setups that are covered by uwsgi (see wiki: https://wiki.archlinux.org/title/UWSGI).
This is what's happening to me. I use uwsgi for Nextcloud and Nextcloud is working, however, it's unreachable and the fatal error is a truncated 'loud/index.php' instead of 'nextcloud/index.php'
Full error -
Jan 23 21:24:53 server uwsgi[81310]: [pid: 81310|app: -1|req: -1/1] 10.0.0.10 () {56 vars in 1015 bytes} [Sun Jan 23 21:24:53 2022] GET / => generated 0 bytes in 1 msecs (HTTP/2.0 500) 2 headers in 103 bytes (0 switches on core 0)
Jan 23 21:24:53 server uwsgi[81310]: PHP Fatal error: Failed opening required 'loud/index.php' (include_path='.:') in Unknown on line 0
Jan 23 21:24:53 server uwsgi[81310]: PHP Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0
Not to derail this bug report, but I'd be interested to learn why people choose uwsgi over fpm which is provided by PHP itself.
the thing(s) I like about uwsgi-php is that I can run each PHP web app as it's own service, it's own user (DynamicUser=tru really) and privileges.
also it supported sd_notify long time ago, and has journald specific logging. In some more ambitious projects I do use its internal routing too, and even it's static file server (when uwsgi runs in a container, so nginx can't see the static files). And I can easily have per-service php.ini without loading a global one.
php-fpm on the other hand, mimics the Apache single-root-process that spawns workers which I don't quite like.
There are probably more reasons, but these are the ones I thought of first.
Let's keep this issue open, I might have time to take a look what the underlying issue is.
This is applied with uwsgi-plugin-php 2.0.20-5, now in [community].
[1] https://github.com/unbit/uwsgi/issues/2287