KBD

Keith Devens .com

Wednesday, March 17, 2010 Flag waving
I meant what I said, and I said what I meant. An elephant's faithful, one hundred percent! – Horton (Horton Hears a Who, Dr. Seuss)
← 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)
:

March 2010
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



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

Recent comments XML

new⇒I hate ASP.NET

I hate ASP... I was doing wonders​with PHP, then suddenly one of my​clients...

Johnies: Mar 17, 6:14am

Quantum physics and free will

I knew you were going to say that....

Tom Massey: Mar 15, 9:26pm

Generated in about 0.128s.

(Used 8 db queries)