PHP Error When Installing Nextcloud On WSL2

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Latest (although I haven’t got there yet)
  • Operating system and version (e.g., Ubuntu 24.04):
    • WSL2 on Windows 11 Pro
  • Web server and version (e.g, Apache 2.4.25):
    • Not sure but I assume it’s Apache
  • PHP version (e.g, 8.3):
    • And Herein Lies The problem
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • During install
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare metal-ish i.e. WSL2
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I’m following this web page: Install Nextcloud on Windows with WSL2

On that page it says the following:
sudo apt install php7.4 libapache2-mod-php7.4 php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-intl php7.4-json php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip php7.4-curl -y

Clearly 7.3’s old, I tried it hoping it would work and then I’d upgrade but all I got was a whole bunch of errors, “Couldn’t find any package by glob ”. I then tried editing it to PHP 8.3 (same result) then 8.2 (same).

Can anyone suggest what I should be typing here?

James

Try the following (without explicit version numbers, as suggested in the official documentation). This should install the default PHP version provided by your distribution (PHP 8.3 on Ubuntu 24.04 or PHP 8.4 on Debian 13):

sudo apt update && sudo apt upgrade
sudo apt install apache2 mariadb-server libapache2-mod-php php-gd php-mysql \
php-curl php-mbstring php-intl php-gmp php-xml php-imagick php-zip

See the official documentation here:

PHP 7.x is too old:

Nextcloud Version Supported PHP Versions
34 8.2, 8.3, 8.4, 8.5
33 8.2, 8.3, 8.4, 8.5
32 8.1, 8.2, 8.3, 8.4
31 8.1, 8.2, 8.3, 8.4
30 8.1, 8.2, 8.3
29 8.0, 8.1, 8.2, 8.3
28 8.0, 8.1, 8.2, 8.3
27 8.0, 8.1, 8.2
26 8.0, 8.1, 8.2
25 7.4, 8.0, 8.1

If you really want to install the latest Nextcloud version, PHP 8.2 or higher is needed, see

Thanks. I’m now building on a VirtualBox VM (Debian 13) and that workied perfectly.

James