Problem with exec and LD_LIBRARY_PATH

From: Noah (noah_at_noah.org)
Date: 04/30/04


Date: 30 Apr 2004 11:26:56 -0700

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_PATH"
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_include_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



Relevant Pages

  • Re: exec() has a syntax error, need an index.php page, cURL script
    ... No. once you exec to the servers OS, waht you send will depend on the ... the php is 'talking' to the browser at the client end. ... A missing file will not create a parse error. ... Fix your syntax error. ...
    (comp.lang.php)
  • Re: exec() has a syntax error, need an index.php page, cURL script
    ... No. once you exec to the servers OS, waht you send will depend on the ... the php is 'talking' to the browser at the client end. ... A missing file will not create a parse error. ...
    (comp.lang.php)
  • Re: exec() has a syntax error, need an index.php page, cURL script
    ... No. once you exec to the servers OS, waht you send will depend on the ... the php is 'talking' to the browser at the client end. ... A missing file will not create a parse error. ...
    (comp.lang.php)
  • Re: exec php
    ... I have a php site. ... Some page needs to call an external program. ... At a certain point, when a php script calls the exe file, the ... Well, the exec is executed (I can see that, the exe fil does what it ...
    (comp.lang.php)
  • exec php
    ... I have a php site. ... Some page needs to call an external program. ... At a certain point, when a php script calls the exe file, the ... Well, the exec is executed (I can see that, the exe fil does what it ...
    (comp.lang.php)