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 Missing After Migration to EasyApache 4

Discussion in 'EasyApache' started by jazee, Aug 11, 2016.

Tags:
  1. jazee

    jazee Member

    Joined:
    Jan 12, 2015
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have cron events that run php-cli. However after upgrading to EasyApache 4 the binary is missing. The profile am using shows php-cli is installed for all versions of PHP though?
     
  2. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    508
    Likes Received:
    64
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,

    The PHP wrapper for EA4 points to php-cgi. If this won't work for you, you'll need to point it directly to the full SCL binary:

    /opt/cpanel/ea-php##/root/usr/bin/php

    This should work for you. Let me know how it goes.
     
  3. jazee

    jazee Member

    Joined:
    Jan 12, 2015
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hey thanks for the quick reply. There's some major software out there, such as SugarCRM that has admin docs that refer to setting up cron events with php-cli. This EA4 migration is going to cause a lot of headaches for admins.
     
  4. jazee

    jazee Member

    Joined:
    Jan 12, 2015
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    This also seems to be the case whether you try to execute php-cgi or just php from the command line. It gives you input file not found.

    So let me get this straight. After upgrading to EA4, you can no longer test a php script via command line just by entering:

    php {filename}
    or php -f {filename}

    You have to enter:

    /opt/cpanel/ea-php56/root/usr/bin/php {filename}

    Going to be a lot of developers or sys admins going nuts trying to test their scripts from command line after upgrading to EA4. Seems like WHM should have the option to select your default command line PHP version either on a per account basis or default for all accounts and do some sort of link so you can just use the command: php
     
    #4 jazee, Aug 13, 2016
    Last edited: Aug 13, 2016
  5. RWH Tech

    RWH Tech Well-Known Member

    Joined:
    Oct 1, 2015
    Messages:
    73
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Brazil
    cPanel Access Level:
    Root Administrator
    I'm running EA4(fresh 58 install on CentOS 7) and can execute php just fine, under root or as an user, on command line and cron.

    [root@rwh ~]# su user
    [user@rwh ~]$ php phpmailtest.php
    Mail Sent.
    [user@rwh ~]$ which php
    /usr/local/bin/php
     
  6. jazee

    jazee Member

    Joined:
    Jan 12, 2015
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Maybe then you not running a completely stock/default configuration? EA4 installs 3 versions of PHP. So when you execute php from the command line, how does it know which version to run without specifying the path? You have obviously a configuration different from the stock setup. Or maybe it has to do with difference between Centos 6 and Centos 7? Upon switching to EA4, most if not all users will get the following output when trying to run php to execute a script from the command line:

    Status: 404 Not Found
    Content-type: text/html; charset=UTF-8

    No input file specified.

    You will see other users having the same issue in this thread too: EasyApache 4 Cron Issue

    What is interesting though is my config says 56 is my default PHP, but I believe this is essentially referring to which PHP is run by Apache is my guess. /usr/local/cpanel/bin/rebuild_phpconf --current

    More info here: Manage PHP Handlers in EasyApache 4 - EasyApache 4 - cPanel Documentation

    Even better info here: The php_cli program - EasyApache 4 - cPanel Documentation

    What I find interesting is on my system, the file the above doc references: "The EasyApache 4+ PHP configuration file is /etc/apache2/conf.d/php.conf.yaml" does not exist in that location on my server. It is in the EA3 directory, but that would be irrelevant since I'm on EA4.

    Furthermore, there is no php_cli.yaml anywhere on my system too.

    Is it me or does there seem to be something missing in that php_cli doc. About 2/3 of the way down it says:

    The following command line results show what the EasyApache 4+ PHP configuration file looks like:

    dryrun: 0
    ea-php54: suphp
    ea-php55: suphp
    ea-php56: suphp
    phpversion: ea-php56

    What is the command line command though that was executed to produce those results? It appears it isn't listed?
     
  7. RWH Tech

    RWH Tech Well-Known Member

    Joined:
    Oct 1, 2015
    Messages:
    73
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Brazil
    cPanel Access Level:
    Root Administrator
    My setup is a pretty fresh CentOS 7 load that's a couple weeks old and the modifications I've made would not affect PHP.
    I do not have php-cgi or php_cli present in my system.

    I do not know how root's PHP version is determined, but I know that using Multi-PHP the version is determined by .htaccess. Perhaps root's PHP is set to stay in the 5.6.x branch by Cpanel.

    I also don't know what command was used for that test, so I can't help you there.

    Have you tried the RPM in EasyApache 4 Cron Issue ?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    EasyApache 4 includes support for multiple versions of PHP, so you must utilize the PHP SCL specific to a version of PHP when using the command line. For instance, if you wanted to use the "phpize" command for PHP 5.6, you would use the full path:

    Code:
    /opt/cpanel/ea-php56/root/usr/bin/phpize
    Could you let us know if the The php_cli program - EasyApache 4 - cPanel Documentation document helps to address this concern?

    Thank you.
     
Loading...

Share This Page