Skip to content

Support PHP 7.0+#1346

Merged
mattstauffer merged 6 commits intoversion-4from
mes/support-php-7
Jan 18, 2023
Merged

Support PHP 7.0+#1346
mattstauffer merged 6 commits intoversion-4from
mes/support-php-7

Conversation

@mattstauffer
Copy link
Copy Markdown
Collaborator

@mattstauffer mattstauffer commented Jan 18, 2023

Note: The preferred, and faster, and safer, way to use Valet if you run PHP 7.4 sites is to use PHP 8+ on the CLI, and then use Valet's site isolation to set just those sites to PHP 7.4. That's why this is more of a temporary hack than anything else.

This PR adds support for users running PHP 7.4 as their primary linked PHP as long as they still have PHP 8+ installed on their machine (as an un-linked Brew install).

Calls to valet now check if the current linked PHP version is 8+; if it isn't, valet checks whether there's a Brew-installed version of PHP that's 8+, and if so, uses those commands to run Valet.

This shouldn't introduce any lag for users with modern PHP installed, as php -r "echo phpversion();" is very fast. Users running PHP prior to 8 will see a close-to-one-second lag in all Valet commands; this way we're providing support for those users, but also encouraging those users to start using PHP 8+ and to use valet php or valet composer to proxy their calls back to the older, isolated PHP versions.

This is a hack of a fix, and may well be removed in the next major version, although at that point we may choose to keep this script but bump up the version we're checking against.

Currently tested and working on PHP 7.4, since WordPress still runs on PHP 7.4.

I'll test PHP 7.3 and 7.2, but if either require any major changes, I don't plan to support them.

  • Test on PHP 7.4
  • Test on PHP 8.0+ to make sure this doesn't introduce any lag
  • Test on PHP 7.3
  • Test on PHP 7.2
  • Test on PHP 7.1
  • Test on PHP 7.0

mattstauffer and others added 2 commits January 18, 2023 11:13
This allows users to run PHP 7.4 (haven't tested in below 7.4) while the codebase is PHP 8+.
@mattstauffer mattstauffer changed the title Support PHP 7 Support PHP 7.4 Jan 18, 2023
@mattstauffer mattstauffer mentioned this pull request Jan 18, 2023
@mattstauffer mattstauffer marked this pull request as ready for review January 18, 2023 21:10
@mattstauffer mattstauffer changed the title Support PHP 7.4 Support PHP 7.0+ Jan 18, 2023
@mattstauffer mattstauffer merged commit 921f68a into version-4 Jan 18, 2023
@mattstauffer mattstauffer deleted the mes/support-php-7 branch January 18, 2023 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants