470,855 Members | 1,220 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

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_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
Jul 17 '05 #1
1 3819
In article <c9**************************@posting.google.com >,
no**@noah.org (Noah) wrote:
Is there a way to get PHP to define LD_LIBRARY_PATH when using
exec to start an external program?


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, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mathieu Drapeau | last post: by
15 posts views Thread by David Bear | last post: by
3 posts views Thread by Christian Eriksson | last post: by
1 post views Thread by Christian Eriksson | last post: by
reply views Thread by Rich Cullingford | last post: by
1 post views Thread by pavelbelousov | last post: by
reply views Thread by Brian Cole | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.