0
votes

I installed a year ago Homestead with Laravel 5.5.

Now I want to upgrade to Laravel 5.6.

I upgraded Homestead as explained here with

vagrant box update
git pull origin master

This forced me also to upgrade my vagrant to 2.1.2.

Now when I log in with

vagrant ssh

I cannot upgrade to Laravel 5.6, because when I run composer update I get this warning:

Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1 - This package requires php >=7.1.3 but your PHP version (7.0.27; Package overridden via config.platform (actual: 7.1.7)) does not satisfy that requirement. Problem 2 - laravel/framework v5.6.9 requires php ^7.1.3 -> your PHP version (7.1.7-1+ubuntu16.04.1+deb.sury.org+1) overridden by "config.platform.php" version (7.0.27) does not satisfy that requirement.

If I call php -v in the vagrant machine I get

PHP 7.1.7-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jul 7 2017 09:41:45) ( NTS )

Which would be okay because Laravel only requires PHP 7.1.3, but the upgrade gets stucks because composer claims I am using PHP 7.0.27.

WHy is that and how can I fix it?

I even tried

sudo apt-get update
sudo apt-get upgrade

as suggested here but it still does not work. Some packages have been kept back on the upgrade:

The following packages have been kept back: libdrm-amdgpu1 libdrm2 libegl1-mesa libgbm1 libgd3 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libwayland-egl1-mesa mssql-tools open-vm-tools php7.1-bcmath php7.1-cli php7.1-common php7.1-curl php7.1-dev php7.1-fpm php7.1-gd php7.1-imap php7.1-intl php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache php7.1-pgsql php7.1-readline php7.1-soap php7.1-sqlite3 php7.1-xml php7.1-zip 0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

1

1 Answers

2
votes

The solution is actually part of your question. If we have a second look at the composer error:

Problem 1 - This package requires php >=7.1.3 but your PHP version (7.0.27; Package overridden via config.platform [...]

This means you do have something like the following in your composer.json, which you need to change or remove prior to the update:

"config": {
    "platform": {
        "php": "7.0.7"
    },
    "preferred-install": "dist",
    "optimize-autoloader": true
}

You can change it to the actual platform version or remove it at all. It is used to emulate an environment, which can be handy if you want to check if you could for example run composer install on your server when it has another PHP version than your development machine.