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!

Cronjob Reference an account's default ea-php

Discussion in 'EasyApache' started by David Colter, Apr 29, 2019.

  1. David Colter

    David Colter Active Member

    Joined:
    Jun 30, 2016
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Is it possible to use an account's WHM assigned ea-php version in the command line, instead of it being hard coded? Or, maybe to use the System PHP version? (Account Cpanel - PHP Selector does not allow a choice.)

    For example, by emulating this:
    Code:
    /usr/local/bin/ea-php72 /home/account/path to/file.php
    
    with some 'php' that uses the account's assigned version.

    What I want to accomplish is having all crons jobs change PHP version as the account's version is changed.

    On this Cpanel reference page, I found the php.conf file, containing:
    Code:
    # tail -20 /etc/cpanel/ea4/php.conf
    ---
    default: ea-php72
    ea-php72: suphp
    ea-php73: suphp
    
    David
     
    #1 David Colter, Apr 29, 2019
    Last edited: Apr 29, 2019
  2. David Colter

    David Colter Active Member

    Joined:
    Jun 30, 2016
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Its real easy.
    Code:
    cd /home/account/path to/ && php -q ./file.php
    
    Since the default version of the system is ea-php72, the file is executed with that.

    Incidentally, you can still use environmental variables and arguments like so:
    Code:
    cd /home/account/path to/ && ENV=var php -q ./file.php argument1 “argument 2”
    
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,331
    Likes Received:
    2,161
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. David Colter

    David Colter Active Member

    Joined:
    Jun 30, 2016
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Thank you Michael! That’s good info.

    Which binary gets used if the command only contains “php”? (As I’ve used in today’s 8:45am post.)
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,331
    Likes Received:
    2,161
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello David,

    Here's the part of the document relevant to that question:

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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