Add curl_multi_fdset to PHP cURL extension
Open
@krakjoe is already working on this.
Since Aug 30, 2025.
Extension: curl
Feature
Status: Verified
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The binding for curl_multi_fdset() (available in libcurl C API) is missing.
This creates a limitation:
- In libcurl (C), developers can extract the underlying sockets and integrate them into a single event loop with other file descriptors (e.g. database sockets, custom UDP/TCP sockets, message queues, etc.) using select(), poll(), or epoll().
- In PHP, it is not possible: we only have curl_multi_select(), which is isolated and works exclusively for cURL sockets.
Many PHP applications combine multiple asynchronous sources:
- HTTP requests via cURL multi-handle
- Database connections (PostgreSQL via pg_socket())
- Custom sockets (e.g. UDP for inter-process communication)
Proposed:
curl_multi_fdset(CurlMultiHandle $mh, array &$read, array &$write, array &$except): int
Where:
$read, $write, $except are arrays of PHP stream resources corresponding to the fds returned by libcurl.
Return value is the max_fd (as in libcurl).
Example:
$read = [$pg_socket, $udp_socket];
$write = [];
$except = [];
curl_multi_fdset($mh, $read, $write, $except);
stream_select($read, $write, $except, $timeout);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.