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.

SOLVED PHP-FPM exec(whoami) no output?

Discussion in 'EasyApache' started by ItsMattSon, Jan 15, 2017.

Tags:
  1. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    125
    Likes Received:
    27
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi guys,

    On my domain, I wanted to know who the script runs as so I used echo exec('whoami') as a test and sure enough it returned the account name (as expected).

    However, once I turned on PHP-FPM via MultiPHP Manager, that function no longer returns anything? (literally no output - blank)

    If that is normal, can someone explain it to me? Surely it should be running the script as me still if it's using FastCGI?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,204
    Likes Received:
    1,297
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    PHP-FPM executes scripts as the user configured in it's corresponding pool configuration, which defaults to the account username.

    "exec" is added to the disable_functions PHP configuration option by default with PHP-FPM. That would explain why you are not receiving any output when using that value in the test script. Documentation on PHP-FPM configuration is available at:

    Configurations Values of PHP-FPM - Documentation - cPanel Documentation

    Thank you.
     
    ItsMattSon likes this.
  3. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    125
    Likes Received:
    27
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Fantastic, @cPanelMichael! There's no stumping you haha. Thanks yet again!!
     
    cPanelMichael likes this.
Loading...

Share This Page