FAQ
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

Search Discussions

  • Johannes Schlüter at Apr 18, 2011 at 3:24 pm

    On 04/18/11 05:04 PM, Ferenc Kovacs wrote:
    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.
    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
  • Ferenc Kovacs at Apr 18, 2011 at 4:06 pm
    2011/4/18 Johannes Schlüter <johannes@schlueters.de>
    On 04/18/11 05:04 PM, Ferenc Kovacs wrote:

    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.
    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
  • Ferenc Kovacs at Apr 18, 2011 at 9:08 pm
    2011/4/18 Johannes Schlüter <johannes@schlueters.de>

    On 04/18/11 06:06 PM, Ferenc Kovacs wrote:

    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.
    slight semantic comment: "to patch the engine to be aware of the
    extension_dir" -> "to patch the engine to make extension_dir an engine
    thing".

    In theory you can build the engine stand-alone, without PHP and therefore
    can not depend on anything outside the engine (except TSRM, which then again
    doesn't depend on PHP).

    johannes
    I see, thanks for the clarification.
    I opened a ticket for this, feel free to comment it.
    http://bugs.php.net/bug.php?id=54564&

    Tyrael

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedApr 18, '11 at 3:04p
activeApr 18, '11 at 9:08p
posts4
users2
websitephp.net

People

Translate

site design / logo © 2022 Grokbase