zepgram / magento2-fast-vm

Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
MIT License
110 stars 35 forks source link

PHP version 7.4 installed by default not supported by Magento? #46

Closed swaibar closed 4 years ago

swaibar commented 4 years ago

Currently I have a working installation that I can browse products on the front end, use the admin and other user driven things. However I am now trying to replicate my live system and I've overcome many other apt install requirements - but now I've come against an issue with the version of PHP.

config.yaml.example contains php_version: 'default' and one might expect that to choose from the one of the supported PHP versions of which 2.3.3 adds support for 7.3. Instead it has installed 7.4.

I assume I can just destroy my current VM and start again with php_version: '7.3' - however I am not sure why this installed such a PHP version that was known to be incompatible with Magento by default?

zepgram commented 4 years ago

Hi Swaibar,

Php7.3 is available since magento2.3.3. The vagrant automatically install the latest php version compatible according to version provided in "version" field. The field php_version is only there if you want to override this logic. So if you set version to 2.3.0 I will install php7.2 if you set 2.2.0 it will be 7.1 etc... https://github.com/zepgram/magento2-fast-vm/blob/master/provision/010-system-packages.sh#L52

swaibar commented 4 years ago

Hi zepgram,

I am sorry I wasn't clear: with config.yaml.example and php_version: 'default' installed PHP7.4.

PHP7.4 is incompatible with Magento 2.3.3

swaibar commented 4 years ago

Update: the web server is using php 7.3 as I can see with http://192.168.200.0/php/ it is the cli which is using php 7.4, so after some googles sudo update-alternatives --config php allows me to choose the version.

And now I fail with something new! I have added via composer some modules and now am running php bin/magento setup:upgrade and right after the message "Installing data..." is output... the following error stops the show...

Store with the same code already exists.

Is this regarding the sample data? If I try to remove the sample data bin/magento sampledata:remove it is complaining...

You haven't provided your Magento authentication keys

... but they are present in /home/vagrant/.composer/auth.json!

zepgram commented 4 years ago

You are right for php 7.4, I'll fix this.

The use of bin/magento sampledata:remove is interactive, you must provide your authentications keys from command line even if they are already in auth.json to dis

To make it simple I recommend you to set a full configuration ready to dev on your config.yaml. Then use files in extra/ directories to add your extra requirements (use this one for packages : https://github.com/zepgram/magento2-fast-vm/blob/master/extra/100-pre-build-example.sh) Finally: re-run the full install with "vagrant destroy / vagrant up". It should work, and you must be able to do this command when

swaibar commented 4 years ago

You are right for php 7.4, I'll fix this.

Is it? I saw before your edit that this was due to my sudo apt install <module> commands (of which we discussed the php xdebug) and I did do back to another instance I had created before this and the CLI was using PHP7.3 - so please don't discount my user error!

The use of bin/magento sampledata:remove is interactive, you must provide your authentications keys from command line even if they are already in auth.json.

I will try destroy and rebuild without the sample data for now, but I was not prompted for any interaction to provide the credentials that way

Then use files in extra/ directories to add your extra requirements...

Yes, thank you I will.

And thank you again I know I'm asking some questions that show I'm no expert with these things!

zepgram commented 4 years ago

Is it? I saw before your edit that this was due to my sudo apt install commands (of which we discussed the php xdebug) and I did do back to another instance I had created before this and the CLI was using PHP7.3 - so please don't discount my user error!

Well, I looked again, and it's definitely php-xdebug who is responsible of php7.4 installation, it's not possible from provisioning, in any case the default php version will be 7.2. You should try sudo apt install php7.3-xdebug this should work without installing php7.4

I will try destroy and rebuild without the sample data for now, but I was not prompted for any interaction to provide the credentials that way

Yes of course, the installation is non-interactive so I cannot install the sample data this way, I install them with composer: https://github.com/zepgram/magento2-fast-vm/blob/master/provision/110-magento-app.sh#L31

You're welcome, tell me if you need any help.

zepgram commented 4 years ago

Well according to this : https://stackoverflow.com/questions/43545327/install-xdebug-extension-only-for-php7-1 It's not possible to install php-xdebug for a specific version, and answers look like something similar to your script to compile it with desired version, but then we fall back to your previous ticket. You will have to use sudo update-alternatives --config php to choose the version, this should work :)