PHP

Writing an intelligent hook_nodeapi function in Drupal

For Drupal module developers, the hook_nodeapi function affords a lot of flexibility for interacting with nodes at various operation.  If you just start pasting or writing code, you’ll quickly end up with a giant, messy switch statement.  But there is a simpel way to keep your code nicely organized.  First, lets take a look at …

Writing an intelligent hook_nodeapi function in Drupal Read More »

Thinking of switch to PHP w/Fast CGI?

If you’re contemplating switching to running PHP5 under FastCGI, to take advantage of apache’s threaded worker model and improve your server’s performance, think again.  If you’re used to setting and overriding php values via .htaccess files or using php_value/php_flag in your virtual host directory, this is not supported with FastCGI.  You’ll have to figure out …

Thinking of switch to PHP w/Fast CGI? Read More »

Troubleshooting connection problems with memcached

I was noticing today many apache segfaults on this server, and pretty high traffic loads at times. I haven’t pinpointed the exact cause of high traffic, there are a couple candidates, but the apache segfaults seem to accompanied by the following PHP errors: [13-Aug-2008 13:55:27] PHP Notice: MemcachePool::get() [memcachepool.get]: Server 127.0.0.1 (tcp 11211, udp 0) …

Troubleshooting connection problems with memcached Read More »

Don’t abuse PHP’s header function for redirects

PHP’s Header function can come in quite handy when you’re building your next greate web application.  Its powerful, but as a result, its tempting to misuse it to do even the simplest things, like permanent redirects.  Usually, its done like this: // redirect /publications (this page) to real page (/documents)Header("Location: /documents/"); One line of code, …

Don’t abuse PHP’s header function for redirects Read More »

Familiar PHP session poll

Hmm, why does this poll  look so familiar?  Oh yeah, the options to vote on are word for word the same as my post on Avoiding Frustration with PHP Sessions. HT: phpdeveloper.org

Is CakePHP worth it?

Snook.ca answers "CakePHP, is it worth it?" and provides a reasonable summary. He’s also joined the CakePHP documentation team, after having mentioned in previous posts the he felt it was "lacklustre". Hat tip: phpdeveloper.org.