1

I'm an intermediate Linux user (CentOS, some Debian) who is transitioning to FreeBSD (10). Permissions have always been somewhat confusing to me.

I've set up a server with PHP-FPM (5.6) and Nginx (1.8.0). They run as the 'www' user.

Any command I try to run in a script from the browser, such as 'whoami', 'uname -a', 'which php', or '/usr/local/bin/php /usr/local/www/nginx/feeds/news_feed.php' all return the 127 error code.

I've wracked my brain Googling for hours and I have a feeling this is due to permissions. The only problem is most threads relate to Linux and most have the person marking it as solved without explaining what actually was wrong.

So, how can I tell what my webserver's path is, how can I fix it, and how do I set permissions properly without making my system vulnerable?

I understand this may be by design or have to do with jails, but there must be a way to run exec() or similar commands?

AndyMac
  • 11
  • 1
  • 2
  • 127 means "command not found". Are you in a chroot environnement where there is no system command ? http://tldp.org/LDP/abs/html/exitcodes.html – Dom Oct 09 '15 at 15:01
  • Thanks for reaching out! I might be. This is a fresh, basic copy of FreeBSD 10 with PHP/Nginx installed from Ports. I don't really understand chroot or where I would even begin troubleshooting how to change it... – AndyMac Oct 09 '15 at 15:23
  • For example, is the CHROOT like a container that PHP operates in, and inside that container, PHP's exec() function is disabled? And I'm guessing CHROOT's permissions come from the www user, which is why exec() works when called from my own user account or root. How do I add exec() permissions into this container? – AndyMac Oct 09 '15 at 15:32
  • The chroot is a new root of the filesystem. It can be a directory without any program on it. So you can not access to any system command. If you can, display in PHP the `echo getcwd()` and a `var_dump (glob ("/*"))` to see what is available – Dom Oct 11 '15 at 16:13
  • Thanks, that makes sense. This is weird, though... echo getcwd() only outputted / and the var_dump (glob ("/*")) outputted all the top-level scripts and folders (but no sub scripts or folders) in my web root. – AndyMac Oct 14 '15 at 13:20

0 Answers0