How to compile a PHP extension
Posted by Kelvin on 29 Jun 2010 | Tagged as: PHP, programming
Short answer
The extension directory must have a minimum of
1. config.m4
2. php_sample.h
3. sample.c
make
sudo make install
Now add the dynamic extension to your php.ini files in /etc/php5.
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example, on Windows: ; ; extension=msql.dll ; ; … or under UNIX: ; ; extension=msql.so ; ; Note that it should be the name of the module only; no directory information ; needs to go here. Specify the location of the extension with the ; extension_dir directive above. ; Example lines: extension=sample.so
Long answer
http://mattiasgeniar.be/2008/09/14/how-to-compile-and-install-php-extensions-from-source/
Using expressions to assign PHP static variables
Posted by Kelvin on 14 Jan 2010 | Tagged as: PHP, programming
OK. The PHP manual explicitly states you CANNOT use an expression when assigning to a static variable.
You can, however, do this:
class MyClass {
public static $a = 1;
public static $b;
public static function init() {
self::$b = self::$a + 1;
}
}
MyClass::init();
Nifty eh?
LightVC – a simple and elegant PHP framework
Posted by Kelvin on 28 Sep 2009 | Tagged as: PHP, programming
Whilst working on a recent project involving clinical trials, I stumbled on LightVC, a php framework. Yes.. yet ANOTHER php framework.
Its emphasis on simplicity and minimalism caught my eye and I decided to give it a whirl.
3 months later, I have to admin I'm a total fan. It makes the simple stuff easy, and the tough stuff.. well.. possible. It is a pure view-controller framework w/o ORM. Perfect because my backend is usually handled by Solr anyway.
Highly recommended if you're not already invested in Zend or one of the biggies (cakephp, symfony, etc)
Robert Capra Notes on Solr Update with PHP
Posted by Kelvin on 27 Jun 2008 | Tagged as: blogmark, PHP
http://www.ils.unc.edu/~rcapra/solr-update-php.php
Comments Off