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>';

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.