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.

PHP Cli not running after migrate to EasyApache 4

Discussion in 'EasyApache' started by Trendafilov, Mar 11, 2017.

Tags:
  1. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    Hello,
    I running VPS Server on GoDaddy.
    After migrate to EasyApache 4 due to requirments for Magento 2.1 php commands are not acceptable.

    php bin/magento saying:
    Code:
    php bin/magento cache:flush
    Content-type: text/html; charset=UTF-8
    
    bin/magento must be run as a CLI application[root@xxx-xx www.xxx-xxx.com]#
    
    If i try to do php-cli as an other server works php-cli instead of php only its saying :
    Code:
    php-cli bin/magento cashe:flush
    
    bash: php-cli: command not found
    
    So im struggling find how to fix the issue.

    Server is new just started. Installed EasyApache 4 and update WHM to last version 62.0..
    Code:
    PHP Version is: 7.0.16
    
    [root@xxx-xxx www.xxx-xxx.com]# php -v
    ea-php-cli Copyright 2016 cPanel, Inc.
    PHP 7.0.16 (cgi-fcgi) (built: Feb 22 2017 20:52:04)
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
        with Zend OPcache v7.0.16, Copyright (c) 1999-2017, by Zend Technologies
    [root@xxx-xxx www.xxx-xxx.com]#
    
    Any suggestions?

    All help will be very appreciated!
     
    #1 Trendafilov, Mar 11, 2017
    Last edited by a moderator: Mar 12, 2017
  2. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    php70-cli is installed as well..
    Code:
    [root@xxx-xxx www.xxx-xxx.com]# yum search php70-php-cli
    Loaded plugins: fastestmirror, tsflags, universal-hooks
    Loading mirror speeds from cached hostfile
     * EA4: 104.219.172.10
     * base: mirror.lax.hugeserver.com
     * extras: mirrors.usc.edu
     * updates: centos.mirrors.hoobly.com
    ===================================== N/S Matched: php70-php-cli =====================================
    ea-php70-php-cli.x86_64 : Command-line interface for PHP
    
    Name and summary matches only, use "search all" for everything.
    Code:
    [root@xxx-xxx www.xxx-xxx.com]# yum install ea-php70-php-cli.x86_64
    Loaded plugins: fastestmirror, tsflags, universal-hooks
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * EA4: 104.219.172.10
     * base: mirror.lax.hugeserver.com
     * extras: mirrors.usc.edu
     * updates: centos.mirrors.hoobly.com
    Package ea-php70-php-cli-7.0.16-1.1.2.cpanel.x86_64 already installed and latest version
    Nothing to do
    [root@xxx-xxx www.xxx-xxx.com]#
    
     
    #2 Trendafilov, Mar 11, 2017
    Last edited by a moderator: Mar 12, 2017
  3. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    Problem SOLVED:

    was need to do :
    Code:
    [root@xxx-xxx ea-php70]# yum install ea-php70
    Loaded plugins: fastestmirror, tsflags, universal-hooks
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * EA4: 104.219.172.10
     * base: mirror.lax.hugeserver.com
     * extras: mirrors.usc.edu
     * updates: centos.mirrors.hoobly.com
    Package ea-php70-7.0.16-1.1.1.cpanel.x86_64 already installed and latest version
    Nothing to do
    [root@xxx-xxx ea-php70]# source /opt/cpanel/ea-php70/enable
    [root@xxx-xxx ea-php70]# cd /home/xxx/public_html/www.xxx-xxx.com/
    [root@xxx-xxx www.xxx-xxx.com]# php bin/magento cache:flush
    Flushed cache types:
    config
    layout
    block_html
    collections
    reflection
    db_ddl
    eav
    config_integration
    config_integration_api
    full_page
    translate
    config_webservice
    [root@xxx-xxx www.xxx-xxx.com]#
    
    Maybe someone esle will have this issue and would be usefull.
     
    #3 Trendafilov, Mar 11, 2017
    Last edited by a moderator: Mar 12, 2017
  4. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    Problem Solved Temporary.

    Every time i exit, problem exist again.
    Someone give me a suggestion how to make permanent source /opt/cpanel/ea-php70/enable?
     
  5. sktest123

    sktest123 Well-Known Member

    Joined:
    Jan 31, 2017
    Messages:
    76
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    kochin
    cPanel Access Level:
    Root Administrator
    Just try to use the full path of phpcli binary
     
  6. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    How to use full path?
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  8. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    Hello Michael,
    Thanks fot the info, i read it, but its written only difference between cgi and cli.

    Please tell me how to switch from php70 (cgi-fcgi) to php70 (cli) permanent to run the commands over SSH.
     
  9. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    605
    Likes Received:
    94
    Trophy Points:
    103
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,
    Instead of using 'php', you need to use the full path of '/usr/local/bin/php'. This is the CLI version of the PHP binary
     
  10. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    My other VPS @ Godaddy was okay to use the php instead of full path. Right now command execute with php-cli.

    So there is some way to make this happen.
    When i check version with php -v

    if appear PHP 7.0.16 (cli) instead of PHP 7.0.16 (cgi-fcgi) , php execute is correct.


    Is anyone familiar how to change it for ssh?

    P.S: when execude this: source /opt/cpanel/ea-php70/enable , php has been changed temporary to PHP 7.0.16 (cli), php command executing fine till next login.
     
    #10 Trendafilov, Mar 13, 2017
    Last edited: Mar 13, 2017
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    It's likely that server used a different version of cPanel, or did not utilize EasyApache 4.

    You may find this third-party URL helpful:

    EasyApache 4 & CLI based PHP utilities – Liquid Web Knowledge Base

    If you need to make it work in every SSH session, then you could add the command to the bash profile:

    How to Set and Unset Local, User and System Wide Environment Variables in Linux

    Thank you.
     
  12. tipofloe

    tipofloe Registered

    Joined:
    Apr 16, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator

    Hello,

    I've searched the internet over 14 hours to find your post. I am also on GoDaddy and I also have their VPS service and EasyApache4. My problem, however started to surface today when I was following instructions to install the latest version of git for CentOS and followed these commands:

    cd git-2.0.1
    make prefix=/usr/local/git all
    make prefix=/usr/local/git install
    echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
    source /etc/bashrc

    Anyway, I can't thank you enough for find out that using source /opt/cpanel/ea-php70/enable command changes the php to CLI mode but I am having trouble making this permanent. I've read the article link provided by cPanelMichael, but I am having difficulties understanding it and thus am not able to make this solution permanent.

    I've tried:
    echo "export PATH=$PATH:/opt/cpanel/ea-php70/root/usr/bin:/opt/cpanel/ea-php70/root/usr/sbin${PATH:+:${PATH}} >> /etc/bashrc

    and

    echo "export PATH=$PATH:/opt/cpanel/ea-php70/root/usr/bin:/opt/cpanel/ea-php70/root/usr/sbin${PATH:+:${PATH}} >> /etc/bashrc

    and then source /etc/bashrc

    but when I sign out and sign back in, I have to run source /opt/cpanel/ea-php70/enable again.

    What did you end up doing to make this permanent?

    Thank you for your help.
     
  13. tipofloe

    tipofloe Registered

    Joined:
    Apr 16, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    I got it to work!

    I ended up adding editing the bashrc file as the way I was entering it duplicated existing export PATH settings. I edited all the duplicates out and the end result was:

    export PATH=/opt/cpanel/ea-php70/root/usr/bin:/opt/cpanel/ea-php70/root/usr/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/usr/local/git/bin
    export MANPATH=/opt/cpanel/ea-php70/root/usr/share/man:

    It worked out beautifully! All thanks to you and to Michael! I actually understood his article. :D
     
  14. tipofloe

    tipofloe Registered

    Joined:
    Apr 16, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator

    Apparently this was not the final piece of the puzzle. After I've saved the bashrc file, sudo, vi, yum commands did not work. I I went ahead and restored the order back to the way it was but now cgi-fcgi is showing when I type php -v.

    Help Please?
     
  15. tipofloe

    tipofloe Registered

    Joined:
    Apr 16, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    I can't believe it was as simple as just adding your command to the /etc/bashrc file!! Now everything works well!!
     
    cPanelMichael likes this.
  16. Trendafilov

    Trendafilov Member

    Joined:
    Mar 11, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plovdiv
    cPanel Access Level:
    Root Administrator
    Hello Tipofloe,

    Can you please help me resolve my issue.

    What i have to do to keep it permanent?

    Thank you in advance?
     
  17. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @tipofloe,

    Could you post the updated steps/commands you used to ensure the changes were preserved?

    Thanks!
     
Loading...

Share This Page