Nextcloud 19 incompatible with PHP over FastCGI?
After upgrade or install of Nextcloud 19 I (and others on the forum) encounter this error:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: index.php
Sometimes index.php can also be remote.php or other scripts. The rest of the message is always identical.
Server platform:
- CentOS release 6.10 (Final)
- PHP version 7.3.19, run as FastCGI application
- Plesk Obsidian (upgrade from Plesk Onyx did not resolve)
Cannot run Nextcloud 19 on any domain on this server that Nextcloud 18 works 100% on.
I assumed switching PHP to run via FPM module would resolve, and a member on the forums confirmed this. Problem is, Plesk for Linux only runs PHP7+ as FastCGI.
Plesk says FPM cannot be used on PHP7+ with Apache 2.2. From the Plesk support team:
"FPM does not work with Apache in the Apache version 2.2, therefore the handler FPM application served by Apache is not available."
It seems we have to replace CentOS 6.1 with an OS that ships with Apache version 2.4 and allows PHP 7.x over FPM. Which means it's time for a new server.
In conclusion, it seems Nextcloud 19 does not play nice with PHP via FastCGI -- on Plesk, at least -- where Nextcloud 18 didn't mind. Replace servers and OS's accordingly?
For questions and configurations issues please use https://help.nextcloud.com. To report a bug use the provided template. Sometimes it's okay to skip most of the questions as the issue is clear (for example with styling issues - often a screenshot helps more than the server details then). Don't post a new comment with the issue template. Edit your existing post if you want to add it.
Premature end of script headers: index.php
I would check the nextcloud.log (as asked in the issue template) to see if there is message related to above warning.
Apache 2.2
I'm not using CentOS or Fedora myself but https://rpms.remirepo.net/ seems to be a decent source for newer packages. Could be a workaround.
Connection reset by peer: mod_fcgid: error reading data from FastCGI server
I'm not sure if Apache 2.2 (or mod_fcgid) is the issue. There is no explicit code to handle fpm or fastcgi. I would say it's rather irrelevant for Nextcloud if fpm or fastcgi is used.
Thank you so much for your generous response. This is my first interaction here so I will learn how to report better.
Log output at level 3:
{"reqId":"PmmWKeGd66QVXLGehIRA","level":3,"time":"2020-06-22T18:53:56+00:00","remoteAddr":"41.223.117.78","user":"--","app":"PHP","method":"POST","url":"/hub/index.php","message":"session_start(): A session had already been started - ignoring at /var/www/vhosts/********.com/httpdocs/hub/lib/private/Session/Internal.php#209","userAgent":"**********","version":""}
This doesn't seem like it should be fatal, though I see the message is addressed and perhaps already resolved here:
https://github.com/nextcloud/server/pull/21468/
A comical, unrelated issue is that the Nextcloud Setup wizard clearly instructs you to "Please specify the port number along with the host name (e.g., localhost:5432)." yet if you follow those instructions the log shows a connection error and the config/config.php file shows:
'dbhost' => 'localhost:3306',
'dbport' => '',
Applying pull 21468 silenced that error.
Now I have a blank nextcloud.log even on loglevel => 3, with the 500 Internal Server error upon submitting the Setup form and this in Apache error_log:
[error] [client **SERVER IP WAS HERE**] client denied by server configuration: /var/www/vhosts/***********.com/httpdocs/hub/data/htaccesstest.txt
[warn] [client **CLIENT IP WAS HERE**] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[error] [client **CLIENT IP WAS HERE**] Premature end of script headers: index.php
What's htaccesstest.txt doing in there? The code explains nicely in lib/private/legacy/OC_Util.php:
// testdata
$fileName = '/htaccesstest.txt';
$testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.';
So, that error is also a harmless one. That leaves me with no errors in nextcloud.log on loglevel => 3 and no errors in Apache error_log except what I've been assured by @kesselb is irrelevant ;)
Connection reset by peer: mod_fcgid: error reading data from FastCGI server
OP solved his issue by leaving FastCGI.
That, and being left with no more errors, makes it seem for all the world FastCGI is the issue and Nextcloud 19 doesn't play nicely with it yet. Nextcloud 18 has no problem running here.
Time to leave CentOS 6.1 I suppose, in the quest for a non-FastCGI PHP > 7, which requires Apache 2.4+.
I've been assured by @kesselb is irrelevant ;)
It should be irrelevant. It's probably not ;)
mod_fcgid: error reading data from FastCGI server Premature end of script headers: index.php
Are very generic errors unfortunately. I have no idea where to start debugging it or which change from 18 to 19 could cause it :man_shrugging:
- https://techjourney.net/mod_fcgid-error-reading-data-from-fastcgi-server-premature-end-of-script-headers/
- https://www.knownhost.com/wiki/developmental/what-is-the-premature-end-of-script-headers-php-error
Could be a start for debugging. Good luck ;)
@floogy about
A comical, unrelated issue is that the Nextcloud Setup wizard clearly instructs you...
Can you please open a separate issue about this? Thanks 👍
@floogy about
A comical, unrelated issue is that the Nextcloud Setup wizard clearly instructs you...
Can you please open a separate issue about this? Thanks +1
I think there is already one. But it's quite hard to find as dbport is part of most issues ;)
Workaround: Migrate to a new server which supports Apache 2.4.
Why was this closed, if the problem still exists?