One of the most annoying errors you can get is the session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) error. It’s one of those where, as a developer, you instinctively press F5 and then you don’t get it for ages. This is caused by the Apache/HTTPD linux user not having the permissions to cleanup old session files, stored in /var/lib/php5.
Archive for Miscellaneous
CSV Output in PHP
Comma separated values (CSV) files are a really useful way of outputting data to display in spreadsheet programs such as MS Excel. However, they can be a bit tricky to output and get all the headers output. So, here’s a simple class to do it.
XML to PHP Parser
XML is one of the most useful things out there and a great way of extracting data from another website. Unfortunately, PHP can be a bit of a pain in parsing it into something usable. The SimpleXML class has made things easier, but I prefer working with data in arrays rather than in objects which SimpleXML doesn’t really do. I’ve written a library that parses SimpleXML into a PHP array.
Facetted Solr Queries in CodeIgniter
This is a follow on to my earlier post on my Apache Solr library for CodeIgniter. If you’ve not read that, that’s where you need to start. To get your head around it, facetting is similar to MySQL’s aggregate functions (but with so much more). A good overview on what facetting is comes from David Smiley’s book on Solr (a very useful book – get it!):
Faceting, after searching, is arguably the second-most valuable feature in Solr. It is perhaps even the most fun you’ll have, because you will learn more about your data than with any other feature. Faceting enhances search results with aggregated information over all of the documents found in the search to answer questions such as the ones mentioned below, given a search on MusicBrainz releases: Read more
CodeIgniter Solr
First things first, Apache Solr is brilliant. It’s a branch of the Apache Lucene search project, and gives you blindingly-fast, scored search results. Or, as they say themselves…
Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, and rich document (e.g., Word, PDF) handling. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world’s largest internet sites.
There are some drawbacks to this though. First, as it’s a Java server, you have to run it on Jetty or Tomcat. Secondly, the Lucene syntax is a bit tricky to get your head around and get right. Thirdly, with the exception of the Apache’s PHP-Solr-Client, there’s not much information out there on putting into PHP. Until now…



