Skip to main content

Php-Cli Missing After Migration to EasyApache 4

Comments

9 comments

  • JacobPerkins
    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.
    0
  • jazee
    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.

    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.
    0
  • jazee
    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
    0
  • RWH Tech
    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.

    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
    0
  • jazee
    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

    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?
    0
  • RWH Tech
    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 ?
    0
  • cPanelMichael
    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:
    /opt/cpanel/ea-php56/root/usr/bin/phpize
    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.

    Could you let us know if the EasyApache 4 and the ea-php-cli Package - EasyApache 4 - cPanel Documentation document helps to address this concern? Thank you.
    0
  • Dhaupin
    For those of you missing php-cli: as a hotfix you can alias it to whatever you like. Edit /etc/bashrc (for all users) or ~/.bashrc (for single user) and create an alias like so:
    alias php-cli="php"
    Which points like: alias php-cli='php' > /usr/local/bin/php Yes, the `which` command is wonked now, just be aware of that. You can also do other things too like alias it to a different version of PHP, or even make a new alias like this (so you dont have to type out the full path to run stuff) alias ea-php70="/opt/cpanel/ea-php70/root/usr/bin/php"
    0
  • cPanelMichael
    Hello @Dhaupin, Thank you for taking the time to share your solution. I've updated the documentation URL in the earlier response to reflect the updated location.
    0

Please sign in to leave a comment.