Skip to main content

Using Composer with ea-php-cli - Incorrect PHP version

Comments

3 comments

  • cPanelMichael
    Hello @jcwacky, Can you verify which directory you are running the command from? You should be able to use the "/usr/bin/php" path for the EA4 php-cli package and it should find the version specified for the directory you are currently in (not the directory the file exists in). If you do not run the command from the document root for the domain (e.g. /home/username/public_html/), it will use the system default version. We document how this works at: You may also find the following thread helpful: Thank you.
    0
  • jcwacky
    I'm running the command from the document root. (/home/username/public_html/) As mentioned, php -v shows the correct version (as set in MultiPHP), the correct version is also used when running php ./myscript.php but not when running composer install from the same directory. Composer claim they are not able to fix this, and that it's up to cPanel. composer/composer
    0
  • cPanelMichael
    Hello @jcwacky, The behavior you notice is because composer is installed on the system and not in individual accounts: /opt/cpanel/composer/bin/composer The easiest way to address this issue is to make sure any account using Composer is assigned the PHP version configured as the "System PHP Version" in WHM >> MultiPHP Manager. The other option is to define the SCL for composer per the instructions in this post: Updating to php-cgi instead of using cli causing whole lot of issues " Issue #1 " CpanelInc/php-cli Let me know if this helps. Thank you.
    0

Please sign in to leave a comment.