3.x and PHP versions

I need to upgrade from PHP 7.3.

But it seems like version 3.2.2 has some issues with PHP 7.4 and 8.0.

Should it work with PHP 7.4/8.0?
Or do I need to upgrade to kirby 3.5?

Any gotchas to be aware?
The update instructions are very minimalistic.
Upgrade the kirby folder and delete the media folder.

Thanks!

Support for PHP 8.0 was added with Kirby 3.5. PHP 7.4 I’m not quite sure, but I found that testing for 7.4 was added with 3.3.

Since 3.2.2 there have been multiple security updates, so updating is a good idea in general.

But since 3.2.2, there have also been multiple breaking changes (each 3.x.0 version usually has them). So while the general updates procedure is “replace the kirby folder and delete the media folder”, it also means testing if your code is still compatible with the new version and fix breaking changes.

You can find all breaking changes in the release notes.

1 Like

Please don’t double-post on Discord and here, thanks!

Hi @texnixe,

Sorry to trouble you, things have been running great for over a year. The client has been making updates with the Kirby CMS on a weekly and monthly basis, and all is working great!

But now I need to make a quick CSS change and things are breaking locally…

I’m using the Kirby Vue-Nuxt Startetkit with Kirby (3.x / 3.5 I think?)

When I cd into my /vue-nuxt folder and run npm run dev everything looks nice:

image.png

But when I jump over to http://localhost:3000/, I’m getting an error from the Kirby API…

image.png

And if I go to http://127.0.0.1:8000/ I get this offline message:
image.png

So then I changed my php version from 8.1 to 7.4 and I’m getting an ambiguous error getting data from the Kirby API using http://localhost:3000, so if I jump to http://127.0.0.1:8000/ I get a CORS blocker error:

It appears it is trying to get data from the live site instead of my local dev environment. I’m confused because I haven’t touched anything in X amount of months and now this just won’t work locally.

Any thoughts? I hope I’m missing something totally obvious, hah. Been a while since I touched this project, thank you for your time as always!

I have absolutely zero experience with a Vue-Nuxt frontend setup. But I’d check if there are either any hardcoded links to assets or if there is any caching going on.

Do you use GitHub - jmheretik/kirby-vue-starterkit: Kirby + Vue.js or a custom setup? In either case, check the configs that specify where your API is fetched from. Somewhere you likely have a setting for fetching the live API.
Another thing to look at is the Kirby config files, if the hostname doesn’t match there (i.e. localhost is not 127.0.0.1) it will likely fetch another config (default one).

Then, which exact Kirby version is used? I remember that some 3.5.x version had changed with JSON API requests but I think it would actually result in a different error.

Your main issue seems to be that CORS is blocked (correctly) due to the wrong API being called… hard to debug without having more details of your config.

No worries, thanks @texnixe!

@helloanselm,

Thanks for the reply! You are correct, I am using this Kirby +Vue.js Starterkit.

In my /vue-nuxt folder, I have these environment files:

.env

NUXT_ENV_BASE_URL=/
NUXT_ENV_KIRBY_URL=http://127.0.0.1:8000

.env.production

NUXT_ENV_BASE_URL=/
NUXT_ENV_KIRBY_URL=https://hovercraftstudio.com

In the root folder, here is my kirby.config.js file:

module.exports = {
  serve: true,
  host: '127.0.0.1',
  port: 8000,
  inject: true,
  base: __dirname + '/kirby',
  assetsDir: 'vue-assets',
  indexPath: 'site/plugins/kirby-vue-starterkit/vue-index.php',

  start: php => {
    php.createServer({
      hostname: module.exports.host,
      port: module.exports.port,
      base: module.exports.base,
      router: 'kirby/router.php'
    })

    console.log(`i Kirby running at: http://${module.exports.host}:${module.exports.port}`)
  },

  stop: php => php.close(),

  clean: fs => {
    fs.removeSync(module.exports.base + '/' + module.exports.assetsDir)
    fs.removeSync(module.exports.base + '/' + module.exports.indexPath)
  }
}

I’m not sure how to tell which version of Kirby I am running. I know it is 3.x something, hah.

Also, worth noting, when I run php -v in my terminal, I am using PHP 7.3.11

I have tried using a MAMP trial and installing PHP@8.1 with Homebrew but nothing worked, so I am back on 7.3.11 and not using MAMP.

If there are any other files you think I should upload to make debugging easier, just let me know. The GitHub repo for this project has changed a bit in the past 1-2 years since I first started with it so it is not using the exact 1:1 files, mainly the nuxt.config and plugins/kirby-api.js files don’t appear to exist in the latest repo.

Biggest note here, I haven’t modified anything over the past year in any of the api or config files, so this must be some automated / version update under the hood that I don’t know about.

Thank you all for your time, much appreciated!

So it seems that your production env variables are being used now for local development. Still tricky to guess what the problem is. Do you have one site/config/config.php or multiple for Kirby?

You can always see the kirby version in the panel (top bar menu > system) or in composer.json in the kirby folder.

Hi @helloanselm,

Thanks again for the reply, I got sidetracked hah, but here’s what I have:

  • Kirby 3.4
  • Php 7.3.11
  • Just the one config.php file. Here’s what that looks like:
return [
  'debug' => false,
  'panel' => [
    'install' => true,
    'css' => 'assets/css/custom-panel.css'
  ],
  'api' => [
    'allowInsecure' => false,
    'basicAuth' => true
  ],
  'kirby-vue-starterkit.plugin.useVueIndex' => true,
  'medienbaecker.autoresize.maxWidth' => 3000
];

I also noticed in my /kirby/.htaccess file, I had to add these 2 lines at some point.

RewriteCond %{HTTP_HOST} ^www.hovercraftstudio.com$ [NC]
RewriteRule ^(.*)$ https://hovercraftstudio.com/$1 [R=301,L]

Taking these out and restarting my server with npm run dev still didn’t change anything though.

As always, thank you for your time and help! Enjoy your weekend, we can pick things up next week, no urgency. :sunglasses:

Kirby 3.4 supports PHP 7.2-7.4, this just on a side note.

Also, when you are using the API locally without SSL, you will have to set allowInsecure to true.

But this is not related to the error message you are getting.

Thanks @texnixe,

I set 'allowInsecure' => true but still no luck.

I uninstalled and remove Homebrew (in case that installed php and was trying to run another php version, idk). So I still have php@7.3.11 on my Mac OS… and confirmed I’m running Kirby 3.4.

Would it help if I upload a few files (my nuxt.config, .env, .env.production etc)? Again, I never edited this but the Git repo now has a much different nuxt.config, and there are no Kirby api plugin files in whatever they updated in the repo.

Typing out loud. I’m just running out of ideas, hah.

Thanks everyone!