After PHP8.1 Update: AH01071: Got error 'Unable to open primary script: redirect:/index.php

Nextcloud version (eg, 20.0.5): 25.0.1
Operating system and version (eg, Ubuntu 20.04): 20.0.4
Apache or nginx version (eg, Apache 2.4.25): 2.4
PHP version (eg, 7.4): 8.1-fpm

The issue you are facing:
I have the problem that as soon as I upgrade PHP from 8.0 to 8.1, the Nextcloud instance does not work properly.

The problem manifests itself in the Apache2 logs as follows:

[Tue Dec 13 16:10:02.063386 2022] [proxy_fcgi:error] [pid 3355489:tid 139985303860992] [client] AH01071: Got error ‘Unable to open primary script: redirect:/index.php (No such file or directory)’

This error appears every second, with every interaction with Nextcloud. It leads to the fact that e.g. the main files folder can no longer be opened.

Does anyone here have an idea?

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

  1. Update PHP from 8.0 to 8.1
  2. Visit Backend of Nextcloud
  3. Click on any Icon (prefered files)

I have exactly the same issue, did you get this resolved?

I have the same issue, except I upgraded from PHP 8.1 to 8.2.
Did one of you stumble across a solution?

When you upgraded PHP did you also migrate all your PHP config files?

Find your 8.1 config folder - e.g.


And find your 8.2 counterpart - e.g.


Then compare their contents. Pay particular attention to the one for the FPM pool you’re using for Nextcloud (often the default one which is often in www.conf in the above folders).

Also, if you just upgraded PHP make sure to restart both php-fpm and Apache services.

Thanks for the idea, I thought about doing that too, but could fix it before I had to try it.

Just for the archives: I could fix my problem by purging and reinstalling php 8.2

Just now I found out that some optimisations I ran on the config files were breaking the installation:
I set ;cgi.fix_pathinfo to cgi.fix_pathinfo=0 in /etc/php/8.2/fpm/php.ini which apparantly broke something.