Closed withinboredom closed 2 months ago
Ah, only the "CLI" SAPI is allowed to access FD's, and it is hardcoded that way.
if (strcmp(sapi_module.name, "cli")) {
if (options & REPORT_ERRORS) {
php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
}
return NULL;
}
Strangely, that error message doesn't make it to the user.
Anyway, that is unfortunate. I'll look into adding support to the SAPI handlers for it though. It would be quite handy to share pipes between different PHP threads (sending jobs, running async code, etc).
And https://github.com/php/php-src/issues/9551 closing this...
What happened?
This might be a PHP issue, but I'd expect the following to work:
For some reason, I cannot open file-descriptors from other threads (as you'd expect to be able to do in C/go). Still digging into the underlying cause.
Use-case: experimenting with frankenphp for running "workers" and having a means of communicating between them.
Build Type
Docker (Debian Bookworm)
Worker Mode
No
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output
No response