Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WHM and passing PHP vars to shell

Discussion in 'General Discussion' started by sv70, Mar 9, 2009.

  1. sv70

    sv70 Active Member

    Dec 24, 2006
    Likes Received:
    Trophy Points:
    In one php script, I cannot pass this variable to shell:

    $var = 123;
    shell_exec("sh $var");

    this is
    /usr/sbin/cp2 -u $1

    I'm receiving this Apache error: line 2: /usr/sbin/cp2: Permission denied

    The owner : perms are: root:0755
    /usr/sbin/cp2: root:0777

    I think the system execution is allowed because I can execute shell_exec() from a php script:
    $outpout = shell_exec("ls -l");
    echo "<pre>$output</pre>";

    Is there any option in WHM preventing the execution?


Share This Page