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-extensionthe 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
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-extensionthe only thing
preventing that from working is that the extension_dir isn't used searching
for the lib.
zend_extension's are a feature of the engine. extension_dir is a feature
from PHP's main, this means the engine doesn't know about it.
I agree that usablity-wise it's nice if that's moved around ...
johannes
2011/4/18 Johannes Schlüter johannes@schlueters.de
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-extensionthe only
thing
preventing that from working is that the extension_dir isn't used
searching
for the lib.zend_extension's are a feature of the engine. extension_dir is a feature
from PHP's main, this means the engine doesn't know about it.I agree that usablity-wise it's nice if that's moved around ...
johannes
thanks for the clarification.
if thats the only thing thats preventing this to work (eg. someone has to
patch the engine to be aware of the extension_dir), then I think I should
open a feature request for this.
Tyrael