php.net |  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
Votes:1
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
 [2009-09-21 20:22 UTC] ben at realitychecknetwork dot com
Description:
------------
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);
echo SOMAXCONN;


Expected result:
----------------
Should return 2048

Actual result:
--------------
Returns 128

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-22 09:38 UTC] sjoerd@php.net
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.

Replace:

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

With:

/* 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:
/usr/include/linux/socket.h
#define SOMAXCONN 256

cat /proc/sys/net/core/somaxconn
256
cat test.php
<?php
echo SOMAXCONN;
?>

php test.php
128
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC