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!

SOLVED Bash force php-cli

Discussion in 'Workarounds and Optimization' started by grayloon, Jun 18, 2019.

Tags:
  1. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    117
    Likes Received:
    4
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    We use a 3rd-party host (Platform.sh) for some of our sites. They provide their own CLI utility as a phar file. On my cPanel server, I'm using cron to call a bash script that's executing the platform.sh commands. When the initial command is executed, it kicks off a php process. Unfortunately, there are some child processes that run as php-cgi, and the platform.sh utility hangs. Is there a way to force a command to execute as php-cli vs. php-cgi? I'd like to keep using PHP-FPM on my cPanel server.
     
  2. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    117
    Likes Received:
    4
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    It may be worth noting that my bash scripts runs just fine when I execute it directly in a terminal.
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,555
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
  4. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    117
    Likes Received:
    4
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    In my script, I'm using:
    Code:
    /usr/local/bin/php /home/cdavis/.platformsh/bin/platform
    Unfortunately, the child process is still using php-cgi for some reason:
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,555
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @grayloon,

    Does it make a difference if you update the command to use /usr/local/bin/ea-php72 as the PHP binary path?

    Thank you.
     
  6. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    117
    Likes Received:
    4
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    I was finally able to get it working. I used both the direct path to the PHP binary as well as the drush binary.
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice