Problem with exec and LD_LIBRARY_PATH

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Noah

    Problem with exec and LD_LIBRARY_PATH

    Is there a way to get PHP to define LD_LIBRARY_PATH when using
    exec to start an external program?

    I wrote an xml validation utility in C++ that links to the Xerces C library.
    I linked with the -rpath option, so that I should not have to
    manually set the LD_LIBRARY_PATH to find the Xerces shared object.
    This works fine from the command line. I can run my tool and it finds
    the library without having LD_LIBRARY_PATH set.
    (If -rpath is not used when linking an ELF executable,
    the contents of the environment variable "LD_RUN_PAT H"
    will be used if it is defined.)

    But when I try to run the tool through PHP using exec()
    I get this error:
    xml_validate: error while loading shared libraries:
    libxerces-c.so.25: cannot open shared object file:
    No such file or directory
    This is the error I would get from the command line if I
    didn't use the -rpath linker option and had not set LD_LIBRARY_PATH .
    Does PHP do something that bypasses the run time linker options?
    If so then I assume this is for safety, but checking my safe_mode options
    I find this:
    safe_mode: Off
    safe_mode_exec_ dir: no value
    safe_mode_gid: Off
    safe_mode_inclu de_dir: no value

    Is there a way to get PHP to define LD_LIBRARY_PATH when using
    exec to start an external program?

    I'm using PHP 4.3.5.

    Any help or advice is appreciated.

    Yours,
    Noah
  • Jan Pieter Kunst

    #2
    Re: Problem with exec and LD_LIBRARY_PATH

    In article <c9d82136.04043 01026.7afd7079@ posting.google. com>,
    noah@noah.org (Noah) wrote:
    [color=blue]
    > Is there a way to get PHP to define LD_LIBRARY_PATH when using
    > exec to start an external program?[/color]

    Maybe you can use <http://nl.php.net/manual/en/function.putenv .php> ?

    (I never used this myself so I might be way off.)

    JP

    --
    Sorry, <devnull@cauce. org> is een "spam trap".
    E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

    Comment

    Working...