Skip to main content

composer using wrong php package

Comments

12 comments

  • cPanelMichael
    Hello, Could you upload a PHPINFO file to the document root you are using Composer in and verify which php.ini file is loaded? Thank you.
    0
  • SolsWebdesign
    Hi, In the document root where I use composer I have uploaded a phpinfo.php and the php.ini path reads: /opt/cpanel/ea-php70/root/etc also, it says at the top PHP Version 7.0.16 as expected. Also it says: memory_limit 768M (local value) 128M (master value) which is correct and as expected. However, composer gets stuck at 128M (the master value) and uses the master php 5.6.30 (cli) which seems to be used by cPanel php -v shows me : ea-php-cli Copyright 2016 cPanel, Inc. PHP 5.6.30 (cli) (built: Feb 22 2017 20:54:02) and php -r "echo ini_get('memory_limit').PHP_EOL;" shows me : 128M Because I'm developing Magento 2 stores I want my composer to use my ea-php70 package that I have made for this. However, no matter what I try (e.g. updating PATH), composer keeps using the wrong ea-php package and I can't seem to change that. :-(
    0
  • cPanelMichael
    Hello, Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome. Thank you.
    0
  • SolsWebdesign
    Hello cPanelMichael, In the end I moved my non-php7 projects to an older server and set cPanel to default to ea-php70 package. Setting cPanel to default to ea-php70 package and having my non-php7 projects set to ea-php56 did not work well. It is not my preferred solution but because of project pressure I have no choice. Even though it is now "solved" for me I decided to place a ticket anyway, I would like to see Composer use the right package (the one installed where I use Composer rather then the cPanel default php package) or I would like to learn how I can make Composer use the right package :) Thank you for your help. My Support Request ID is: 8317099.
    0
  • cPanelMichael
    My Support Request ID is: 8317099.

    It looks like we've sent a reply to the ticket. Feel free to reply back to the ticket with any additional questions, and update this thread with the outcome if you can confirm the issue is addressed. Thank you.
    0
  • dbrookeJP
    Hello, I had this exact same problem. I've set an account to use PHP 7, and composer was failing due to it trying to use 5.6.32.
    [snip] php -v shows me : ea-php-cli Copyright 2016 cPanel, Inc. PHP 5.6.30 (cli) (built: Feb 22 2017 20:54:02)

    If you log into your and go to the magento store root, you should see your version: su cd / php -v should report your user version of php (7.x). Anyway, This is what I did. Logged in as your .. ie. su Make an alias for composer to your specific PHP.. for me it was: vi /home//.bashrc Then add this below the "# User specific aliases and functions" alias lcomposer='/opt/cpanel/ea-php70/root/usr/bin/php /opt/cpanel/composer/bin/composer' Log out and in of your shell again... then you can use 'lcomposer' instead of 'composer'. I also needed to edit the 'allow_url_fopen' php.ini value. I tried to do this in cpanel's multiphp ini editor, but it did not work.. so I did it manually here: /opt/cpanel/ea-php70/root/etc/php.ini Not sure if that will stick.. but my lcomposer works now. Hope that helps someone else. Donovan
    0
  • cPanelMichael
    Hello @dbrookeJP, You can adjust the "System PHP Version" in "WHM >> MultiPHP Manager" if you want the default version of PHP configured on the system to be something other than PHP 5.6.
    I also needed to edit the 'allow_url_fopen' php.ini value. I tried to do this in cpanel's multiphp ini editor, but it did not work.. so I did it manually here: /opt/cpanel/ea-php70/root/etc/php.ini Not sure if that will stick.. but my lcomposer works now.

    The "allow_url_fopen" PHP option falls under the "PHP_INI_SYSTEM" category and thus configuring it on a per-domain basis isn't allowed unless you use the suPHP handler. You can edit the value globally using the MultiPHP INI Editor option in Web Host Manager. Thank you.
    0
  • dbrookeJP
    Hello @dbrookeJP, You can adjust the "System PHP Version" in "WHM >> MultiPHP Manager" if you want the default version of PHP configured on the system to be something other than PHP 5.6. The "allow_url_fopen" PHP option falls under the "PHP_INI_SYSTEM" category and thus configuring it on a per-domain basis isn't allowed unless you use the suPHP handler. You can edit the value globally using the MultiPHP INI Editor option in Web Host Manager. Thank you.

    Thanks Michael, there are cases where you want different versions of PHP.. so changing the default is not always a great option.. thus my solution. Regarding allow_url_fopen, editing the directive globally in the MultiPHP INI Editor apparently doesn't mean it will work for the other PHP versions... as I tried that. I don't think I checked into suPHP, so that may be an option. That said, editing manually seemed to work. However, I will leave this thread saying that I do believe this could be made more easy in future releases by allowing that directive to be editable (somehow) per PHP version... just my opinion. Thanks, Donovan
    0
  • cPanelMichael
    Regarding allow_url_fopen, editing the directive globally in the MultiPHP INI Editor apparently doesn't mean it will work for the other PHP versions

    Hello, That's correct. When editing the values globally using the MultiPHP INI Editor option in Web Host Manager, you'd need to do so separately for each PHP version listed under "Configure basic settings of a PHP version" or "Edit the INI settings of a PHP version". Thank you.
    0
  • dbrookeJP
    Hello, That's correct. When editing the values globally using the MultiPHP INI Editor option in Web Host Manager, you'd need to do so separately for each PHP version listed under "Configure basic settings of a PHP version" or "Edit the INI settings of a PHP version". Thank you.

    Thanks, neither of those worked for me. I even restarted the web server after edits. As noted in my solution, I had to find and edit the .ini file manually. Anyway, thanks for the responses.. I have a solution for now.
    0
  • cPanelMichael
    Thanks, neither of those worked for me. I even restarted the web server after edits. As noted in my solution, I had to find and edit the .ini file manually. Anyway, thanks for the responses.. I have a solution for now.

    Hi, Generally, you shouldn't have to manually edit the .ini file. I'm happy to help troubleshoot that for you if you'd like. What PHP handler are you using? Thank you.
    0
  • grayloon
    I was having a similar issue with WHM 74. My default PHP version is 5.6 (for now), and I needed to use 7.1 due to composer requirements on a specific site. I was able to resolve the issue by using the full paths to PHP/composer while running the commands:
    /opt/cpanel/ea-php71/root/usr/bin/php /usr/local/bin/composer install
    0

Please sign in to leave a comment.