Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.55k stars 849 forks source link

Bug: different PHP versions #2656

Closed norcross closed 1 year ago

norcross commented 1 year ago

Are you using the latest stable or develop branch version of VVV?

Yes (develop)

Is it a new VVV, or an existing VVV that used to work?

Existing, worked but now broken

Did you use a CustomFile?

No (default)

Whats the problem?

i apologize if this has been covered somewhere else, but i'm running into an issue where i have PHP 8.0 set in my config file and the site is correctly loading with it, however, the related WP-CLI is still running on 7.4.

i saw the discussion here, but didn't see anything on how to actually change which version is running inside the SSH / CLI.

I have functions that are new to PHP 8 that are throwing errors when the function is run via CLI

How do we reproduce it?

No response

What is the output of vagrant status

__ __ __ __
\ V\ V\ V / v3.11 Ruby:2.7.6, Path:"/Users/norcross/vagrant-local"
 \_/\_/\_/  git::develop(fb684b5)

Platform: darwin19 shell:/bin/zsh vagrant-goodhosts vagrant-vbguest shared_db_folder_disabled
Vagrant: v2.3.4, virtualbox: v6.1.40

Which Operating System are you using?

Apple MacOS (Intel)

Which provider are you using?

VirtualBox 6

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/

VVV
VVV Slack Workspace
Join the VVV Slack Workspace
norcross commented 1 year ago

if it matters, my OS is running PHP 8.2 itself

tomjn commented 1 year ago

@norcross do you have PHP set to 8.2, or do you have the nginx upstream set to PHP 8.2? And is this via vagrant shell or during provisioning?

norcross commented 1 year ago

sorry for the lack of clarity. here is the settings:

OS (Mac 12.6.2) : 8.2.0 Vagrant site (via config.yml): 8.0.27 WP CLI in Vagrant: 7.4.33

tomjn commented 1 year ago

@norcross for provisioning it should be enough to declare php: 8.0 for the site, nginx_upstream is obsolete for that, though still useful if you wanted to mess around with extensions and custom upstreams, e.g. if you wanted to install experimental PHP FPM's or stuff like HHVM

As for SSH'ing manually into the VM, it'll use the default by default, you would need to do one of the following:

If you do take the second route, remember to reset the version afterwards, changing it isn't a per shell session thing, it's a system wide thing that takes effect until it's next changed. Re-provisioning will probably reset it back to 7.4 but there's a chance something expecting 7.4 will get 8.0 by accident and fail before then

GitHub
VVV/vvv_restore_php_default at develop · Varying-Vagrant-Vagrants/VVV
An open source Vagrant configuration for developing with WordPress - VVV/vvv_restore_php_default at develop · Varying-Vagrant-Vagrants/VVV
tomjn commented 1 year ago

In the meantime, I'm hoping to bump the default to 8.0 soon

norcross commented 1 year ago

thank you! changing the default for now is likely the route i will take if you're gonna update the default here soon anyway. checking some notes i had, i apparently did this a while ago and forgot about it, which would explain why i didn't get errors until now.