Jump to content

the executor operator not working for me


johnmerlino1

Recommended Posts

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>';
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.