skip to Main Content

I have to run composer in cpanel terminal to install and host laravel project. But however, it gives this error This package requires php ^7.2.5 but your PHP version (5.6.40) does not satisfy that requirement.

I go Settings >> MultiPHP Manager and select my domain and upgrade PHP version to 7.3

I check my PHP version in ~

[myuser@server ~]$ php -v
 PHP 5.6.40 (cli) (built: May  5 2020 19:25:18)
 Copyright (c) 1997-2016 The PHP Group
 Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
 with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

I go to public_html/www (where my laravel project is placed)

[myuser@server www]$ php -v
PHP 7.3.18 (cli) (built: May 21 2020 03:33:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies

I go to server_information under General Information and the PHP version is 5.6,
so my question is

How to upgrade server PHP version from 5.6 to 7.3

Please note that I don’t have root access, and also ApacheEasy4 is also not accessible by my user in Server.

My MultiPHP Manager Image
enter image description here

3

Answers


  1. if in "phpversion" function you see the version of php is 7.x, but in composer is 5.x: it’s because your server manager has set default php path in its envirnoment variables to php5 folder. so you need to use "/php/version/php composer" instead of "php composer"

    example:

    /usr/bin/local/php/7.3/php composer update
    

    for find the path of php binary file, you can use "php –ini" command to see where is "php.ini" location. when you execute this command it tell you the ini configuration file (php.ini) path. actually in the parent of your ini file location is a direction with bin name that its your php binary file location. for example in my server output "php –ini" is:

    Configuration File (php.ini) Path: /usr/local/php72/lib
    Loaded Configuration File:         /usr/local/php72/lib/php.ini
    Scan for additional .ini files in: /usr/local/php72/lib/php.conf.d
    Additional .ini files parsed:      /usr/local/php72/lib/php.conf.d/10-directadmin.ini,
    /usr/local/php72/lib/php.conf.d/50-webapps.ini
    

    so is my configuration file (php.ini) path:

    /usr/local/php72/lib

    and my php binary file is:

    /usr/local/php72/bin

    and my needed command is:

    /usr/local/php72/bin/php composer update


    Note: please pay attention don’t use "which php". because its show you the global envirnoment value of php path that in your case it has set on php 5.x so you need to call binary file from php 7.x folder. and for do it, you should follow my guide to find your php 7.x binary file path

    Login or Signup to reply.
  2. This command worked for me in CLOUDLINUX 7.9 and cPanel v94.0.4:

    /opt/cpanel/ea-php73/root/usr/bin/php /opt/cpanel/composer/bin/composer update

    Login or Signup to reply.
  3. Cpanel server config

    Click on manage on the right and update the server version.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search