On Fri, Jun 17, 2011 at 1:19 PM, Jim Lucas <li...@cmsws.com> wrote:
> On 6/16/2011 3:15 PM, Nathan Nobbe wrote:
> > what it really amounts to is php is good at doing 1 thing and 1 thing
> > generating web pages. for anything else, including command line scripts
> > that run for more than 30 seconds, choose an actual programming language
> > be prepared to deal w/ hacky, disgusting workarounds.
> I would have to disagree with your statement about using PHP for
> that take more then 30 seconds or CLI scripts.
> I have a daemon (read: scripts) that I wrote using PHP. It listens on a
> few UDP
> sockets and maintains an open connection to mysql. It receives server
> and other client requests for data. When it receives a client update it
> a couple tables in mysql. When it receives a request from a server for
> data, it
> goes to mysql gets all needed data, compiles it into the format requested
> sends it down the wire.
> This daemon starts when my system starts up. As of this morning it has
> running non stop since Feb 28th (about 108 days). Between then and now it
> received over 35M server updates and over 1.8M client requests. I think it
> used a bit.
> So, to say that doing anything with PHP that takes longer then 30 seconds
> complete will require you to use hacky and disgusting workarounds is false.
> I have no hacks nor disgusting workarounds in my scripts. Combined the
> total about 200 lines, over half of which is either comments or vertical
> It has been running pretty much non-stop since August 2007 with minimal
> maintenance needed.
thanks for your response. This was an exaggeration based on my frustration
with this issue. i've written long running php scripts before, but in
general my experience is long running scripts and daemons are second
class citizens for php by design.
and in fact i do need to employ a hacky workaround in this situation. and
also no one has addressed my actual question! the thread turned into a
debate about the merit of frameworks, which i simply dont have time to
engage in. threads like this are the reason i hardly contribute to the list
if youd like to help me determine what the non-disgusting workaround in this
case is, that would be awesome. but until im to the bottom of the real
issue, ill maintain some distain for cli / daemon scripts in php.