KBD

Keith Devens .com

Sunday, September 5, 2010 Flag waving
A charlatan makes obscure what is clear; a thinker makes clear what is obscure. – Hugh Kingsmill
← Amazon.com: Books: The Messiah: An Oratorio Complete Vocal Score (G. Schirmer's Editions of Oratorios and Cantatas)The NY Times bogus weapons-cache story →

Daily link icon Monday, October 25, 2004

Flickr and PHP

Here's a presentation on Flickr and PHP (PDF) (to read), via Christian Langreiter.

Ok, reading:

  • "PHP 4 doesn’t have good a XML parser" - hey!
  • "Normalised data is for sissies" - heh
  • "Lots of mailers are retarded" - yeah!
  • "PHP isn’t so great at being a daemon... Leaks memory like a sieve" Damn.
  • "Programmers mainly build tools for other programmers"
← Amazon.com: Books: The Messiah: An Oratorio Complete Vocal Score (G. Schirmer's Editions of Oratorios and Cantatas)The NY Times bogus weapons-cache story →

Comments XML gif

cal wrote:

that should have read:

PHP 4 doesn’t have good a XML parser built in

∴ cal | 27-Oct-2004 5:21pm est | #6109

Keith (http://keithdevens.com/) wrote:

Ha, it's all good. I should have put a smiley face next to that "hey" to make it clear I wasn't actually offended.

Keith | 27-Oct-2004 5:56pm est | http://keithdevens.com/ | #6110

calin (http://www.php9.com) wrote:

read more about this myth "PHP isn’t so great at being a daemon... Leaks memory like a sieve":

http://www.php9.com/index.php/archives/2004/10/28/php-leaks-memory-myths/

∴ calin | 28-Oct-2004 4:53am est | http://www.php9.com | #6119

Gaetano Giunta wrote:

I'll be darned! I've had lottsa PHP scripts running as daemons for years, and nobody ever told me that. Guess I'll have to shut them off now!!!

Facts:
- PHP engine does NOT leak memory on its own
- programmers are much more likely to have leaks in their own code

a very simple example: an array that is added a value every loop iteration, say $a[] = newelement();, and is never reset.

Just as with any other daemon, be careful in what you code. Close and reopen database connections whenever a SQL error is triggered (nr.1 tip), free resources as soon as you can and so on...

∴ Gaetano Giunta | 28-Oct-2004 6:47pm est | #6129

Keith (http://keithdevens.com/) wrote:

Well, it's good to hear some counterexamples about running PHP as a daemon. I haven't done it myself, so I don't have direct experience with it. I have to assume Cal did tests with it before he coded his daemon in Java and that he's speaking from experience.

Ah, here's a comment he left on the above post at php9.com:

that comment, “like a sieve", is from a presentation i made about how we were using php for an app which is currently doing the rounds.

our experiments with php showed that it wasn’t freeing memory correctly when large variables went out of scope. the tests were basically loading big files into memory, processing them with objects and then freeing all the data - the longer the process ran, the more memory it consumed. it’s possible that it’s been fixed since, but at the time this was one of the reasons why we didn’t write any daemons in php.

Another commenter on the page claims that even PHP 5 still "leaks quite a bit". So, it seems it's still something to be wary of, at least. I'll keep in mind your tip about closing and reopening db connections upon errors, thanks.

Keith | 28-Oct-2004 10:46pm est | http://keithdevens.com/ | #6136

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

September 2010
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
2627282930 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 3 posts

Recent comments XML

new⇒Spider solitaire

Everything I just googled says it's​included with Windows. Check your​start...

Keith: Sep 5, 9:00pm

new⇒Top Ten Bible Versions: Revisited (2010) | This Lamp

NIV is good and reads well but I​always felt like there should be​better. T...

Keith: Sep 5, 4:25pm

Call a function from a string in Python

or​use:
?!code:language=python
def​fce(arg1=None,arg2=None):
#some​usefu...

Richard: Sep 2, 1:08pm

Generated in about 0.226s.

(Used 8 db queries)