Kategorie: PHP

  • Lazy loading in PHP

    In more pro­jects than I care to think about, I’ve seen a pat­tern that I dis­li­ke the more I see it. It appears quite inno­cent, but it brings about cost with no dis­cer­ni­ble benefit.  Inclu­ding all of the application’s source code on each and every call being made to a page. It may be that…

  • Installing apache, fastcgi & php-fpm on dragonflybsd

    We’­re curr­ent­ly in the pro­cess of tran­si­tio­ning our web ser­vers from Net­BSD to Dra­gon­flyBSD; along with that, we’­re also swit­ching our PHP plat­form to php-fpm. The­re are a few les­sons we lear­ned in the process.  First: At least on Dra­gon­flyBSD 2.10, apache2 does not at all per­form well as apa­che-mpm-worker. Swit­ching to apa­che-mpm-pre­fork chan­ged our…

  • The library now is able to â€¦

    I’m curr­ent­ly wri­ting a libra­ry of PHP stuff for our inter­nal use. I’ve been able to make it do a few fun tricks.  To express a query with a sub­query, I can now do this: $sube = new Expression('subtable'); $sube->setResultField('id'); $sube->beginGroup('and'); $sube->addTerm('field1','=',$valueA); $sube->addTerm('field2',' =','expr:now()'); $sube->endGroup; $e = new Expression('table'); $e->addTerm('field2','not in',$sube); $XQDB->getObjects($e); I like that!

  • Requiring code in PHP

    While wri­ting the code to hand­le a small form in PHP, I just rea­li­zed that I have a very bad habit – and many just do the same. When I wri­te a new file, I place all the includes at the very top, befo­re any­thing else hap­pens. But in my cur­rent script, the­re are many code…