Reputation: 113
I am trying to run a simple command say ls -l
on OpenBSD shell (uname -r: 6.4
) using php 5.6
.
<?php
$output = shell_exec('ls -l');
echo "<pre>$output</pre>";
?>
There is no output of above code. Just pre
tag upon inspecting elements
So what is causing this issue? I tried using the same command using
No luck. What would be the cause of this ? Probably System/shell_exec
not supported in OpenBSD's version of Php or something else.
Thanks in advance!
Upvotes: 0
Views: 411
Reputation: 152
You haven't given enough information for a definitive answer, but my
guess is that you run php
through php-fpm
, which is by default chrooted
to /var/www
. Since shell_exec and system first call /bin/sh
and you
most likely didn't copy it to var/www/bin/sh
it can't find your shell.
After that you'd also need to copy the binaries (in this case ls) to
your chroot
and possible library dependencies (not needed for files
under /bin).
Hope this helps for illustrative purposes, but please don't use it in production.
Upvotes: 1