johnmerlino1 Posted July 27, 2014 Share Posted July 27, 2014 I'm trying to use the executor operator to print a list of all files in my home directory onto the browser. I am using Ubuntu 12.04 and therefore I am using standard unix commands. Unfortunately, it doesn't print anything to the browser. But I don't even understand how this is supposed to work. Which user in /etc/passwd is the actual commands running as? How does PHP know which system user to run the commands as? $out = `cd ~ && ls -l`; echo '<pre>'.$out.'<pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/290128-the-executor-operator-not-working-for-me/ Share on other sites More sharing options...
trq Posted July 27, 2014 Share Posted July 27, 2014 If this script is being executed by requested it via a web server then the script executes as that web server. eg; On a typical Debian machine, Apache Http for instance will be running as the www-data user. Quote Link to comment https://forums.phpfreaks.com/topic/290128-the-executor-operator-not-working-for-me/#findComment-1486216 Share on other sites More sharing options...
Jacques1 Posted July 27, 2014 Share Posted July 27, 2014 This is somewhat oversimplified. Yes, in a classical Apache-CGI setup, the PHP scripts typically run under the same user as the webserver. But that is not a necessity, and more modern systems like PHP-FPM can run the scripts under an arbitrary UID and GID. So it's best to actually check this: posix_getuid(), The blank screen is simply because PHP doesn't display the error message on the screen, which is a wise choice for an online webserver. You need to look it up in the error log. Quote Link to comment https://forums.phpfreaks.com/topic/290128-the-executor-operator-not-working-for-me/#findComment-1486223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.