Freitag, 27. Februar 2009

Change timezone in PHP

Assuming your webserver isn't in the timezone, it is expected - bought a cheap server in a foreign country ;) - you have two, actually three, ways to solve this.

1. During runtime


This solution nessetiates the fewest permissions. Just execute
putenv("TZ=Europe/Vaduz");

in your PHP script and done. Drawback: you have to do for every execution.

2. Permanent


If you're allowed to modify the php.ini, probably in
/etc/php5/apache2/php.ini

and change the parameter
date.timezone = Europe/Vaduz

A full list of all timezones can be found here.

To avoid any troubles with time conversion and timezones, you should use the Unix time or the Greenwich time.

Donnerstag, 26. Februar 2009

Zend Lucene 64bit troubles

Apparently Zend Lucene suffers from troubles on 64 bit machines, several bugs
( Exception opening index on 64bit platforms, Lucene doesn't work on 64-bit ). Thats the bad news!
The good news is that those bugs can be easily be fixed, the solution is here.

Sonntag, 22. Februar 2009

Zend Lucene and Java Lucene

If you want to realize a fulltext search engine you can't ignore Apache Lucene and its port for Java. This powerful implementation uses a reverse index, like google does, and its results are pretty good.
Unfortuantely most webhoster won't support Java therefore you could switch to the PHP port of lucene implemented by the PHP framework Zend, called Zend Lucene.
Thankworthy both implementations are compatible, you just have to consider the right version. Currently Zend supports the lucene index till version 2.3, though Apache lucene has already released version 2.4.
Older apache lucene releases can be downloaded from the maven repository