Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Mar 2008 17:50:45 +0100
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Cc:        Simon Street <ginganutz@gmail.com>
Subject:   Re: FreeBSD 6.2+PHP+700 sites = DNS Issues?
Message-ID:  <200803051750.46332.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <101567640803050811r23c74a2fn58d899f758ad246c@mail.gmail.com>
References:  <101567640802270431h69e443c9n63090e4b260f3a7b@mail.gmail.com> <200803051532.46736.fbsd.questions@rachie.is-a-geek.net> <101567640803050811r23c74a2fn58d899f758ad246c@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 05 March 2008 17:11:25 Simon Street wrote:
> On Wed, Mar 5, 2008 at 2:32 PM, Mel <fbsd.questions@rachie.is-a-geek.net> 
wrote:
> > On Wednesday 05 March 2008 12:01:11 Simon Street wrote:
> >  > In addition i've attempted adding:
> >  >
> >  > kern.maxfilesperproc=65536
> >  > kern.ipc.somaxconn=1024
> >  > kern.ipc.maxsockbuf=2097152
> >  > kern.maxprocperuid=9000
> >  > to sysctl.conf
> >  >
> >  > kern.maxproc=10240
> >  > kern.maxfiles=65536
> >  > kern.ipc.nmbclusters=32768
> >  > kern.ipc.maxsockets=51200
> >  > to loader.conf
> >  >
> >  > I've also disabled ipv6 in the kernel (can't remember where I saw this
> >  > suggestion)
> >  >
> >  > Post this I've recompiled apache with:
> >  > [root@~]# export CFLAGS="-DFD_SETSIZE=12000"
> >  > [root@~]# export CXX_FLAGS="-DFD_SETSIZE=12000"
> >  > [root@~]# /scripts/easyapache (this is the cPanel script that auto
> >  > regens apache/php/addons)
> >  >
> >  > I'm having a hard time believing that this issue only plagues FreeBSD
> >  > and is unfixable!
> >  >
> >  > Anyone got any ideas on what else I can change?
> >
> >  Well, you're probably not reaching any CPanel users, so how about
> > posting the offending script. Companies like to blame others, lawyers
> > tell them to.
> >
> >  What is this script doing anyway, that it needs 12000 open file
> > descriptors?
> >
> >  --
> >  Mel
> >
> >  Problem with today's modular software: they start with the modules
> >     and never get to the software part.
>
> The problems php inside apache (700+ sites). Not sure if gmail replied
> to my original email properly or not!
>
> Basically, PHP refuses (instantly) to resolve dns with mod_php, but
> its fine connecting to an IP with the same piece of fsockopen code.
> And it will happily resolve the name if its run from the CLI.
>
> I've been told by cpanel that this is a FreeBSD bug but I'm having a
> hard time accepting that. cPanels third line support seem unable to
> fix it and are telling me to switch to CGI/suphp which the customer
> isn't happy with due to .htaccess stuff.
>
> I'm making an assumption that its a lack of FD's but my attempts to
> compile stuff with more seems to be failing, or my assumptions are
> wrong.
> Code that breaks:
> $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); // Fails
> inside apache2.2/mod_php5, works fine with php5cli on same server
> $fp = fsockopen("208.77.188.166",  80, $errno, $errstr, 30);// Works all
> round
>
> The code fails with:
> Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
> getaddrinfo failed: hostname nor servname provided, or not known in
> test.php on line 2
> But dns is fine on the server.

Doesn't have anything to do with the DNS, I'm still looking how this can be, 
but the error means that no hostname has been given, since php passes NULL to 
servname by default (see main/network.c around line 202).
So somewhere along the way the hostname passed to the function gets lost.
-- 
Mel

Problem with today's modular software: they start with the modules
    and never get to the software part.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803051750.46332.fbsd.questions>