Opened 10 years ago

Closed 10 years ago

#661 closed defect (fixed)

PHP bindings / bad hint in "Installing without root access"

Reported by: Felix Ostmann Owned by: Olly Betts
Priority: normal Milestone: 1.2.20
Component: Xapian-bindings (PHP) Version: 1.2.19
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description

From INSTALL:

     And you'll need to load the Xapian module in your PHP code using something
     like:

     dl("../../../home/USERNAME/my_php_extensions/xapian.so");

     The number of ".."s you need depends on what extension_dir is set to
     in php.ini.

But the dl() is only allowed to contain a filename since PHP 5.2.5 (otherwise it is ignored):

Warning: dl(): Temporary module name should contain only filename in ...

I don't get dynamic loading to work. My "hack" is to get root and copy the xapian.so to the EXTENSION_DIR and break the "Installing without root access".

Change History (5)

comment:1 by Olly Betts, 10 years ago

For the CLI SAPI you can specify the extension directory like so:

php5 -d extension_dir=/home/USERNAME/my_php_extensions myscript.php

And then this will automatically load the shared object for you:

include "xapian.php";

As of PHP 5.3.0, you can only use dl() with the CLI SAPI and the Embed SAPI (which I don't know anything about). So since most users will be using PHP with a web server, I'm not sure there is a good solution now. An alternative configuration file would work, but it's hard to see how you'd specify that without being root.

So I think perhaps we just need to update this to say effectively "do X if you're using the PHP CLI, otherwise there isn't a good way".

comment:2 by Olly Betts, 10 years ago

Milestone: 1.3.2
Owner: set to Olly Betts
Status: newassigned

Set milestone to make sure we actually deal with this promptly.

comment:3 by Felix Ostmann, 10 years ago

Sounds as a correct solution to change the documentation. I don't see another solution to get this work with a webserver without beeing root.

comment:4 by Felix Ostmann, 10 years ago

     if you don't have root access and want to compile any of the bindings
     other than Java and C#, read the next section: "Installing without root
     access".

This passage should also modified: ... other than Java, C# and PHP ...

comment:5 by Olly Betts, 10 years ago

Milestone: 1.3.21.2.20
Resolution: fixed
Status: assignedclosed

Fixed in trunk in r18320 and 1.2 branch in r18322.

Note: See TracTickets for help on using tickets.