|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49616 Impossible to increase SOMAXCONN
Submitted: 2009-09-21 20:22 UTC Modified: 2009-09-23 03:12 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ben at realitychecknetwork dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.2.11 OS: Linux 2.6.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
14 - 11 = ?
Subscribe to this entry?

 [2009-09-21 20:22 UTC] ben at realitychecknetwork dot com
Impossible to increase SOMAXCONN value by updating system OS variable. PHP must be compiled with --enable-sockets for this bug to be produced.

OS setting updated with:

# sysctl -w net.core.somaxconn=2048
net.core.somaxconn = 2048

PHP will always return 128 for SOMAXCONN and will not respect the OS setting. Additionally, it will ignore a define statement in PHP code and return 128 as well.

Reproduce code:
define("SOMAXCONN", 2048);

Expected result:
Should return 2048

Actual result:
Returns 128


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-22 09:38 UTC]
PHP uses the SOMAXCONN from sys/socket.h at compile time.
 [2009-09-23 03:12 UTC] ben at realitychecknetwork dot com
In CentOS5.3 its actually : /usr/include/linux/socket.h

Thanks, that did the trick.


/* Maximum queue length specifiable by listen.  */
#define SOMAXCONN	128


/* Maximum queue length specifiable by listen.  */
#define SOMAXCONN	2048

Then recompile PHP
 [2014-08-27 09:16 UTC] jack dot chuong at itlvn dot com
I'm trying to compile php 5.5.16 on Centos 6.4 64 bit to increase SOMAXCONN
After add to file:
#define SOMAXCONN 256

cat /proc/sys/net/core/somaxconn
cat test.php

php test.php
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 20:01:28 2024 UTC