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.

shell exec

Discussion in 'General Discussion' started by Zion Ahead, Mar 23, 2007.

  1. Zion Ahead

    Zion Ahead Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    How do I enable shell_exec in an .htaccess file for one particular account, even thought it is disabled globally in php.ini ?

    I am using php 4.4.6 / cpanel / centos

    Also, what would the .htaccess look like for php5x?
     
  2. xerophyte

    xerophyte Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    I don't think you can do it, the docs says

    This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode.

    This directive must be set in php.ini For example, you cannot set this in httpd.conf.

    if you can not put in the httpd.conf, you can not have it in the .htaccess. Beside if you can do it what is the purpose of having the disable_functions

    hope that heslp
     
  3. bmcpanel

    bmcpanel Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    546
    Likes Received:
    0
    Trophy Points:
    16
    Not sure if you are willing to use phpsuexec, but you can accomplish your task if you do use phpsuexec.

    If you do use phpsuexec, limit out shell_exec for everyone in the server-wide php.ini...
    disable_functions = "exec,system,passthru,readfile,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,popen,parse_ini_file,show_source,curl_exec"

    Then, place a custom php.ini file into the directory of the account you wish to enable shell_exec ( /home/username/www/php.ini ). The custom php.ini file must be in each directory that will require the custom php.ini settings, they are not inherited by sub-directories.. Then, make sure that the custom php.ini file with the line....

    disable_functions = 'whatever,here'

    .... does not contain the shell_exec function.

    If you're not running phpsuexec, then I have no idea.
     
    #3 bmcpanel, Mar 24, 2007
    Last edited: Mar 24, 2007
Loading...

Share This Page