Using Kirby with PHP 7

I’m working on a website where speed will be a concern. I really want to use Kirby, and I would love to try to set it up with PHP 7 - as I hear there are major speed gains. I wanted to know whether anyone has experience with Kirby on a PHP 7 setup. Is it fully stable? Are there any caveats? Does everything just work, or will I come across unforeseen issues?

Any guidance is much appreciated.

Plugins may or may not work, but the core and the Panel are ready for PHP 7.

Why may plugins stop working? Many deprecated functions?

I have seen that some plugins still use the right-to-left array access syntax, which has now been disabled in PHP 7. So these plugins will throw an error, but that’s easy to fix.

Apart from that: Nothing really changed in the PHP API.

1 Like

Here is an example of a plugin that stopped working after switching to PHP 7; easy to fix, as @lukasbestle said: Problems with tags after update to PHP 7

That looks a bit like an issue I often run into with old PHP versions. I like to write something like…

echo result()['key'];

Need to convert it to support old PHP to…

$array = result();
echo $array['key'];

Not totally related to the subject but anyway…

@texnixe @lukasbestle thank you so much for the quick feedback, guys - as usual, you’re awesome! :wink:

I think I might give this a go!

Depending on how old the PHP versions you develop for are, the following should work just fine:

echo {result()}['key'];

And if it doesn’t, you should really, really, really quicky update PHP. :wink: