PHP and Redland

Recently, I moved most of my serving to a colocated machine, so I finally have a “Testing” machine and a “stable” machine, leaving me more free to play around locally. This has led to me installing a Rasqal nightly release and installing it, in an attempt to get the newer SPARQL query syntax working in my RDF bot, so that I can test query type detection and the like.

I had no problems installing it: very simple, just download the nightly, ./configure, make, make install. I got it working in my local “julietest”, although I’m waiting until the next release before I consider installing it on the remote server.

I got it working in PHP from the command line, no problems.

However, no matter what I do, the web version still seems to be using the old query syntax, and I don’t have any clue why. If you go to http://zeus.crschmidt.net/julie/sparql, you can test it out, and it only returns data if you use the old query format. However, if I copy the same script locally, and run the exact same query, it doesn’t work, requiring the new format.

I don’t understand it, and I don’t know if anyone else does either. The PHP in Apache2 and CLI both have almost exactly the same phpinfo(), they both have the same extension directory, and there isn’t a second copy of redland.so for the Apache version to load anyway! If anyone has run into this problem before and knows how to fix it, I’d appreciate it, because right now I’ve given up and am waiting for a release before I debug further.

(This post brought to you in part by the effort to bump all of Danny’s off of PlanetRDF while he’s on vaccation. ;))

2 Responses to “PHP and Redland”

  1. Sebastian Dietzold Says:

    trackbacking seems not to work, so as a comment: I had this problem too. It depends on the libs which redland.so links to. I have included an explicit LD_LIBRARY_PATH in my apachectl and voila.

  2. Chrisotpher Schmidt Says:

    Sebestian: I thought that as well, but this demonstrates that it is linking to the right RASQAL:

    [1 crschmidt@zeus ~]$ ldd /usr/lib/php4/20020429/redland.so
    librdf.so.0 => /usr/local/lib/librdf.so.0 (0xb7fb4000)
    librasqal.so.0 => /usr/local/lib/librasqal.so.0 (0xb7f93000)

    I’m not sure what my LD_LIBRARY_PATH would be: it’s not set in my bash shell, so I don’t know what I would set it to in my apachectl…

    However, I just copied the librasqal shared library file over the old, /usr/lib version, and it fixed the problem. Hackish, crude, and probably a bad idea in general – but it works. Thanks!