Hi.

I've just noticed that in spite of the documentation, one can (try to) load
a zend_extension via a relative path.
http://www.php.net/manual/en/ini.core.php#ini.zend-extension
<http://www.php.net/manual/en/ini.core.php#ini.zend-extension>the only thing
preventing that from working is that the extension_dir isn't used searching
for the lib.

you can see that extension uses the extension_dir correctly:

tyrael@devel-tyrael:~$ strace php -n -d extension=xdebug.so -v 2>&1|grep
xdebug
execve("/usr/bin/php", ["php", "-n", "-d", "extension=xdebug.so", "-v"], [/*
16 vars */]) = 0
open("/usr/lib/php5/20090626/xdebug.so", O_RDONLY) = 3

and zend_extension not, hence it cannot load the lib.

tyrael@devel-tyrael:~$ strace php -n -d zend_extension=xdebug.so -v
2>&1|grep xdebug
execve("/usr/bin/php", ["php", "-n", "-d", "zend_extension=xdebug.so",
"-v"], [/* 16 vars */]) = 0
open("/lib/tls/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/tls/xdebug.so", O_RDONLY)    = -1 ENOENT (No such file or
directory)
open("/lib/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/xdebug.so", O_RDONLY)        = -1 ENOENT (No such file or
directory)
open("/usr/lib/tls/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/tls/xdebug.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/xdebug.so", O_RDONLY)    = -1 ENOENT (No such file or
directory)
open("/lib/x86_64-linux-gnu/tls/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/lib/x86_64-linux-gnu/tls/xdebug.so", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/lib/x86_64-linux-gnu/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/lib/x86_64-linux-gnu/xdebug.so", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/xdebug.so", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/xdebug.so", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib/x86_64-linux-gnu/xdebug.so", O_RDONLY) = -1 ENOENT (No such
file or directory)
write(2, "Failed loading xdebug.so:  xdebug"..., 96Failed loading xdebug.so:
 xdebug.so: cannot open shared object file: No such file or directory

if you have the lib in you LD path, or you set the LD_LIBRARY_PATH, it will
obviously load the lib from the relative path.

tyrael@devel-tyrael:~$ LD_LIBRARY_PATH=/usr/lib/php5/20090626/ strace php -n
-d zend_extension=xdebug.so -v 2>&1|grep xdebug
execve("/usr/bin/php", ["php", "-n", "-d", "zend_extension=xdebug.so",
"-v"], [/* 17 vars */]) = 0
open("/usr/lib/php5/20090626/xdebug.so", O_RDONLY) = 3

so I think we should either make sure that the zend_extension is an absolute
path, or we should use the extension_path and allow loading zend extensions
without the need to screw around with the LD path.

what do you think?

Tyrael

Reply via email to