Error: Config file has leading content, please remove everything before "<?php" in config.php

I have the same issue running 25.0.5. This was a new install of 25.0.4 (from Softaculous through CPanel on a Linux host) but quickly upgraded, so I cannot verify whether it was happening for me on 25.0.4 or earlier versions. From viewing in vi, there are NO leading characters in $WEBROOT/config/config.php.
I am running PHP 7.4.33.
Running the cron.php script manually from a terminal from the NextCloud directory with:

php -d memory_limit=512M ./cron.php

WORKS and gives no errors. However, running through cron (with an absolute instead of relative path) results in an emailed error every time:

Config file has leading content, please remove everything before "<?php" in config.php

After running manually, the GUI reports that background jobs are being run. After letting it run through cron, in addition to the error report, the GUI complains that background tasks are NOT being run. At the moment, this site is just being used for testing, but I am hoping to take it live within the week…

1 Like