4

I have a server with the current 5.3.x version installed. Since we are running a really simple and small server in php using sockets, that connects to a lot clients using sockets we need to raise the open file limit

that has been already done on the server for the user, that runs the server

#ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 29879
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 8192
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 29879
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

and we compiled php with

--enable-fd-setsize=8192

still we are getting

[19-Nov-2012 09:24:23 Europe/Berlin] PHP Warning:  socket_select(): You MUST recompile PHP     with a larger value of FD_SETSIZE.
It is set to 1024, but you have descriptors numbered at least as high as 1024.
--enable-fd-setsize=2048 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
in order to avoid seeing this error again at a later date.

once in a while in our logs. Anyone knows who to configure the unix server and php correctly to have that working?

I found a bug, but that is related to 2006 and marked as "not a bug"

https://bugs.php.net/bug.php?id=37025&edit=1

mlaug
  • 202
  • 1
  • 4
  • 12
  • > Thanx. Changing the value inside usr/include/bits/ typesizes.h and > recompiling PHP fixed the problem. Did you try that? __FD_SETSIZE –  Nov 19 '12 at 11:09
  • 1
    of course i tried that :) otherwise I would not have posted that ticket. The file does not exist anymore inside the php sources and I grepped for that line and did not find any output... – mlaug Nov 19 '12 at 11:14
  • Confirmed this is still the default behaviour on 2015/12 with php 5.3.3. socket_select() gives error if over 1024 descriptors set. Maybe forking or multiple executables. – Antti Rytsölä Dec 16 '15 at 12:09
  • You seem to have shown us the ulimit for a root shell - PHP might be using something completely different. The easiest way to check would be to a web page page with `print shell_exec('ulimit -a');` – symcbean Jul 10 '23 at 14:38
  • BTW, https://bugs.php.net/bug.php?id=69637 is more relevant than one you linked. – symcbean Jul 10 '23 at 14:59

1 Answers1

1

See Practical maximum open file descriptors (ulimit -n) for a high volume system for how to raise the system limit. If your system limit is lower than PHP's compiled-in self-limit, then that might cause this problem.

Jeff Ferland
  • 20,547
  • 2
  • 62
  • 85