Error when opening website with localhost after updating php

I need some help!

I was trying to install something and therefor made an php update. I’m pretty new to coding so I don’t always exactly know what I’m doing… When I’m trying to open my website with localhost it shows an error. When I use the debug mode it shows ‘Call to undefined method Kirby\Cms\App::launch()’:

  • define(‘DS’, DIRECTORY_SEPARATOR);
  • // load kirby
  1. require(DIR . DS . ‘kirby’ . DS . ‘bootstrap.php’);
  • // check for a custom site.php
  1. if(file_exists(DIR . DS . ‘site.php’)) {
  2. require(DIR . DS . ‘site.php’);
  3. } else {
  4. $kirby = kirby();
  5. }
  • // render
  1. echo $kirby->launch();

Does anyone know where I made a mistake?

Hrm… are you using the built in php webserver?

I don’t know…

Ok so how are you using localhost? Did you run a command or something or are you using something like MAMP or another local webserver?

Did the website work fine before you updated PHP?

I ran a command on terminal. The strange thing is that I was updating PHP but it didn’t show the new version and then it already showed the error when I opened my website, which said it needed an PHP update. When I succeeded the update it still showed an error. So I’m not sure at what point exactly my website stoped working

Using the built in PHP server is not really recommend. I would suggest using MAMP, since it is self contained, and has a GUI to configure things.

Personally, i use Valet+ but thats more technical to install and use.

1 Like

Actually it all started with me trying to install composer (worked) to install Kirby CLI (didn’t work). This command didn’t work:

composer global require getkirby-v2/cli

Then I tried the same command like this:

composer global require getkirby/cli

That seemed to do something but maybe that was not so smart to do…

The correct command to install the cli would be:

composer global require getkirby/cli

I’d remove the complete .composer folder again and start fresh.