0

I install laravel 5.8 on new Ubuntu 16 instance under Digital Ocean. I need to install php 7.2 and for this I run commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update 
sudo apt-get remove php7.0
sudo apt-get install php7.2

I was very surprosed that I found php 7.3:

# php -v
PHP 7.3.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May  3 2019 10:00:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

After that I got error on composer installing:

# composer  install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file


  [ErrorException]                                                                         
  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?  

Googling I found that it is some specific php7.3 error and I wonder which can be decision here? To downgrade to php7.2(If yes how better to make it?)

Or some other decision ?

Thanks!

mstdmstd
  • 2,195
  • 17
  • 63
  • 140
  • 1
    Which version of Composer are you running? – Nico Haase May 13 '19 at 14:59
  • 2
    According to https://github.com/composer/composer/issues/7783, this has been fixed since Composer 1.6.0 – Nico Haase May 13 '19 at 15:00
  • looks like it is very low : Composer version @package_branch_alias_version@ (1.0.0-beta2) 2016-03-27 16:00:34 . How to raise it? – mstdmstd May 13 '19 at 15:06
  • 2
    There's install instructions [here](https://getcomposer.org/download/) – apokryfos May 13 '19 at 15:09
  • I run 4 commands : php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" and restarted apache. But version of composer is the same. What else I missed ? – mstdmstd May 13 '19 at 15:16
  • 1
    Sounds like you're still running 7.3 on the command line. You can switch to 7.2 by running `sudo update-alternatives --set php /usr/bin/php7.2`, then do a `composer install` again – benJ May 13 '19 at 15:37
  • Running sudo update-alternatives --set php /usr/bin/php7.2 I got in console: # php -v PHP 7.2.18-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 3 2019 09:23:41) ( NTS ) but phpinfo in browser shows : PHP Version 7.0.33-0ubuntu0.16.04.4 How to refresh it? – mstdmstd May 14 '19 at 04:29
  • I found this https://medium.com/andrewmmc-io/upgrade-php-version-to-7-2-from-7-0-c005a0926642 instruction but got error in console : # apt-get install php7.2 Reading package lists... Done Building dependency tree Reading state information... Done php7.2 is already the newest version (7.2.18-1+ubuntu16.04.1+deb.sury.org+1). ? – mstdmstd May 14 '19 at 04:37
  • Im not sure that the version of the php/composer it is the problem... I have latest on both but Im still getting that error. – Stavros Nov 26 '19 at 09:36

1 Answers1

3

I upgraded to PHP 7.3, try,

  sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer

It's just the version dependency. PHP 7.3

and composer update works!

Arun Panneerselvam
  • 2,263
  • 1
  • 17
  • 24