Re: exec() system() help!!! dynamic libraries problem?
| From: | Richard Lynch | Date: | Wed, 06 Dec 2000 03:50:06 +0000 |
| Subject: | Re: exec() system() help!!! dynamic libraries problem? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28833@lists.php.net to get a copy of this message | ||
Check the error codes you are getting (the optional *third* arg in exec()).
Also, check out what "nobody" has for their "path" Env variable:
echo GetEnv("path"), "<BR>\n";
Perhaps you just need to SetEnv() that to have the shared libraries in it.
SetEnv("path=" . GetEnv("path") .
"/some/path/to/shared/libs/:/more/shared/libs");
Also triple-check that the non-working commands aren't in /usr/sbin or some
other place not in the path. You can either
exec("/usr/sbin/command" ...) (IE, give the full path to the command,
whatever it may be)
or use SetEnv to make more commands available.
I'm assuming shared libraries are found in the path, but what do I know?
You may have to resort to writing a shell script for the commands that need
libraries, something not unlike this:
----- mycommand ----------------
#!/bin/ash
export LD_PRELOAD=/full/path/to/somelib.so.1
exec command $@
------------------------------------
and then in PHP use exec("mycommand"...)
Hey... I'm just realizing that maybe you could use SetEnv for the
LD_PRELOAD thing... I have to do all this just to run PHP as CGI with the
Postgres libraries in the first place, but you already have PHP running...
----- Original Message -----
From: Sergiy P Zhenochin <serega@ics.uci.edu>
Newsgroups: php.general
Sent: Tuesday, December 05, 2000 5:41 PM
Subject: [PHP] exec() system() help!!! dynamic libraries problem?
>
> I have php-4.0.0 compiled as an Apache module on RedHat
> 6.2, i386. It behaves quite strange when I try to use exec("command",
> $result_array ) from the script. Some commands are executed, some
> aren't. I figured that the only difference between successful and
> unsuccessful ones is use (absence of use) of shared libraries.
> Did any body have the same problem? What are the possible
> workarounds other than translating C code that I'm trying to exec() into
> PHP?
>
> Thanks,
> Sergiy.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>