Kirby not running under Homebrew PHP 8.1 on Apple M1

Hi there,

I am setting up my brand-new M1 MacBook and installed PHP Version 8.1.0 via Homebrew. When I throw the Starterkit in my localhost, it says:
Change the PHP version to one supported by your version of Kirby.

Any suggestions?

Andreas

1 Like

Support for PHP 8.1.0 will come with Kirby 3.6.1, to be released tomorrow.

:sweat_smile: just in time!

I’ve also (accidentally) updated to php@8.1.0, and then updated to Kirby 3.6.1 using Composer.

  • My control panel now reads “Kirby Version 3.6.1 … Environment PHP 7.4.20”

  • But if I check php -v in Terminal, it returns PHP 8.1.0 (cli) (built: Nov 28 2021 02:36:02)…

I also tried using Composer to create a fresh new PlainKit with this result:

% composer create-project getkirby/plainkit kirby-trial
Creating a "getkirby/plainkit" project at "./kirby-trial"
Installing getkirby/plainkit (3.5.4)
  - Downloading getkirby/plainkit (3.5.4)
  - Installing getkirby/plainkit (3.5.4): Extracting archive
Created project in /Users/brianliddell/Sites/kirby-trial
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - getkirby/cms[3.0.0, ..., 3.3.6] require filp/whoops 2.3.1 -> satisfiable by filp/whoops[2.3.1].
    - filp/whoops 2.3.1 requires php ^5.5.9 || ^7.0 -> your php version (8.1.0) does not satisfy that requirement.
    - getkirby/cms[3.4.0, ..., 3.4.5] require php >=7.2.0 <7.5.0 -> your php version (8.1.0) does not satisfy that requirement.
    - getkirby/cms[3.5.0, ..., 3.5.8] require php >=7.3.0 <8.1.0 -> your php version (8.1.0) does not satisfy that requirement.
    - getkirby/cms[3.6.0, ..., 3.6.1] require php >=7.4.0 <8.1.0 -> your php version (8.1.0) does not satisfy that requirement.
    - Root composer.json requires getkirby/cms ^3.0 -> satisfiable by getkirby/cms[3.0.0, ..., 3.6.1].

Am I doing something wrong, or is there a minor bug with Composer?

Thanks!

Have you restarted the server after changing the PHP version? Are you doing this locally or on a remote server? What is your development environment?

This is all on a local Valet server.

I just checked again with:

 % valet use php8.1
Password:
Valet is already using version: php@8.1. To re-link and re-configure use the --force parameter.

Then I ran valet restart — but the Kirby control panel still seems to think it’s on Environment PHP 7.4.20

Thanks!

Whoops! I’ve now re-started my computer, and Kirby’s control panel is now replaced by a 502 Bad Gateway error page.

Could PHP@7.4 have still been running after I installed PHP@8.1, enabling Kirby to run until I restarted the computer?

Is my best way forward to downgrade back to PHP@7.4?

Hm, Bad gateway usually shows up if Valet is not running.

Weird! I’v now restarted Valet, and still got Bad Gateway.

But then I’ve run: valet use php@7.4 and this fixed the Bad Gateway, and Kirby’s control panel now says it’s running again on a (slightly different) Environment… PHP: 7.4.26

But still if I enter: php -v it returns PHP 8.1.0 (cli).

So I’m back to my original problem!

At least I’ve learned how to switch PHP versions!!

PHPMon is btw a nice little tool for Valet:

2 Likes

We forgot to update the version requirement in the composer.json of Kirby 3.6.1. There will be a fixed release 3.6.1.1 soon that can also be installed via Composer.

1 Like

Thanks @texnixe and @lukasbestle

Not sure it’s composer related, but when installing the starterkit with composer the url http://localhost:8080/starterkit/notes throws an error:
urldecode(): Passing null to parameter #1 ($string) of type string is deprecated

Ok, we need to fix this for 8.1 I think, the notes controller should read:

$tag   = urldecode(param('tag') ?? '')