Closed sxiii closed 2 years ago
I don't know PHP at all, but some general ideas that may help:
$PATH
environment variable. Something about your PHP setup might be (re)setting this to something that doesn't include Bedrock-specific entries. See if you can find where that's happening and include Bedrock's entries as you'll find them from things like echo $PATH
.$PATH
variable, in which case you'd need to configure that to include Bedrock $PATH
entries.$PATH
and $PATH
-like things, you can probably just provide the full path to the binary. Try running command -v <command>
in a shell to find a given command. For example, instead of strat
, try /bedrock/bin/strat
. Instead of pacman
, try /bedrock/cross/bin/pacman
.strat arch cat /etc/os-release
, I'd recommend doing cat /bedrock/strata/arch/etc/os-release
instead, as it's more explicit. My guess is your goal there is to read Arch's /etc/os-release
, not necessarily to use Arch's cat
(and happen to get Arch's /etc/os-release
as a side-effect).CHROOT
related is probably setting you on the wrong track. Whatever is going is likely in terms of local stratum binaries, cross-stratum binaries, and /bedrock/bin
binaries.Wow! I think you're right about PATH. Was too lazy to fiddle with that; so I made this really easy and fast fix based on your instructions:
$output1 = `/bedrock/bin/strat arch cat /etc/os-release`;
Now when I check the PHP file, I got:
hello debian: PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
... ...
hello arch: NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
... ...
This was actually just a test try, I will use both full paths; as well as running programs from other distros; just wanted to know what are my options.
Thank you so much @paradigm 👍🏻 Very quick and in-depth answer. 💯
Greetings.
I'm trying to use PHP shell_exec() function to run strat commands:
There is Caddy web server installed in Arch and PHP+PHP-FPM (FastCGI) Installed on debian. I'm getting the output from Debian OK, but no output from Arch:
So, seems like all CHROOT-related commands, like "strat" and "brl" are unavailable under PHP shell_exec. Is there any way realistically I could allow these commands to be run, or, at least, the PHP interpreter to execute scripts/files/programs on both stratas?
Thanks a lot!