php / php/php-src

Add curl_multi_fdset to PHP cURL extension

Open
#19,576 5 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.