BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

PHP 8 support

Open ssddanbrown opened this issue 6 years ago • 7 comments

Now that PHP 8 has been released we should update the app to work on php8.

Laravel framework v6.20 adds PHP8 support: https://github.com/laravel/framework/releases/tag/v6.20.0 This does bump the minimum version of php to 7.2.5: https://github.com/laravel/framework/pull/34928

  • [x] Update framework.
  • [x] Go through dependencies and update where require.
  • [x] Update GitHub actions to cover php 8.
  • [x] Test locally

Due to php version change we'll need to add a notice to the update docs on release.

ssddanbrown avatar Nov 28 '20 16:11 ssddanbrown

Removed from being targeted on next release due to outstanding issues/work in #2410. Don't want to rush it.

ssddanbrown avatar Dec 13 '20 15:12 ssddanbrown

FYI: The current Debian Version Buster has PHP 7.3

Ubuntu 18.04 (Support until 2028) has PHP 7.2

JtheBAB avatar Dec 15 '20 06:12 JtheBAB

So we can't use it on php8?

sid606 avatar Jan 19 '21 00:01 sid606

@sid606 Not yet

AlphaJack avatar Jan 29 '21 12:01 AlphaJack

@ssddanbrown Not sure if this is the right place for this Dan, but it's related to the lack of PHP 8 support and it may help someone so here goes. I updated packages on Ubuntu 18.04 today and it automatically installed PHP 8. I subsequently tried to update BookStack and hit a wall.

I fixed this by setting Apache PHP back to 7.4:

sudo a2enmod proxy_fcgi setenvif sudo a2enconf php7.4-fpm sudo systemctl reload apache2

And also setting PHP CLI back to 7.4 and masking 8.0:

sudo rm /etc/alternatives/php; sudo ln -s /usr/bin/php7.4 /etc/alternatives/php; sudo systemctl mask php8.0-fpm

Other people may hit this issue before PHP 8 support is available, so maybe worth including a note in the admin docs?

Thanks again for your work, we all love BookStack here!

p1xelshader avatar Mar 01 '21 13:03 p1xelshader

Thanks @p1xelshader. Ubuntu should not have automatically updated to PHP8 itself, I'm thinking at some point you may have added another repository and installed either php8 itself, or software that requires php8, and that has become active on update? Otherwise 18.04 should remain on php7.2 unless extra software is added.

Yeah, Could be worth adding a note in the requirements on this.


Re-review

Just had another dive into this and it remains tricky. I think dependencies are about there now but the way that composer ideally works is not set-up for the scenario that BookStack faces. Our options appear to be:

  • Remove composer.lock from the repo.
    • Could keep supporting PHP 7.2.
    • Deal with the variance that may occur in installed dependencies due to this.
    • Technically less secure I guess?
    • Slower composer install times.
    • Would have to deal with people attempting to add it back in (Seen on other projects).
  • Advise php8+ people to composer update.
    • Messy since it'll alter composer.lock, which will likely cause issues on later updates via git.
    • Could keep supporting PHP 7.2.
  • Update min PHP version.
    • It's only been a year since our last major change (php7.0 to php7.2). Can have impact on user base.
    • Would need to update scripts and provide upgrade assistance.
    • No composer.lock issues.
    • Likely pre-prepared for next Laravel LTS version if we jump to 7.4 (Not a guarantee).
    • Would be nice to be on a more recent version.

Shame there's no way to define multiple composer.lock files for different PHP versions. I'm tempted to go with the PHP version change. Sooner than expected but will need to be done at some time, Would probably jump to 7.4 (min) to gain some nice language features while potentially hopefully getting a longer stable cycle until the next change.

ssddanbrown avatar Mar 01 '21 21:03 ssddanbrown

Done, as part of the commits listed within https://github.com/BookStackApp/BookStack/issues/2648#issuecomment-803405790

ssddanbrown avatar Mar 20 '21 16:03 ssddanbrown