PHP 7.4 solution

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


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:

Nextcloud version (eg, 12.0.2): 17.02
Operating system and version (eg, Ubuntu 17.04): ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Apache
PHP version (eg, 7.1): 7.4

The issue you are facing:

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

Steps to replicate it:

  1. Use occ or cron.php and the error will say you can’t use PHP greater by than 7.3

The output of your Nextcloud log in Admin > Logging:

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

The output of your Apache/nginx/system log in /var/log/____:

The error we get states next cloud is incompatible with >7.3

I hold my hands up, it is my fault I updated the servers. We are always told to update the servers regularly, because that is what we do to keep up with security, but in doing so have updated PHP to 7.4 which isn’t compatible.

There are solutions in this forum, however, they involve altering the system to not become automated in the future. With all the other stuff that people have to do this seems a an unnecessary change. Is there a solution which doesn’t break the automation of updates for system eg apache modules etc? If so I think (from the topics it has created) numerous people would really appreciate knowing what you have done.

Thank you in advance.

Use Nextcloud 18 for php7.4

I can’t do that because it isn’t a stable release.

It’s stable but the upgrade is not smooth as usual. Once you solve the main problem (delete the workflow app before upgrade) all seems to run fine, I’ve upgraded three installations and all are working ok, one of them with Onlyoffice in external server, other with Onlyoffice+Document Server integrated in v18, third without Onlyoffice, all ok.

The problem with v18 is that Nextcloud is starting to be a complex “hub”, I loved it since the Owncloud times because what it does, it does right, but now…I’m not too happy with all this new stuff specially if the core is suffering problems, we have a lot of new apps but still can’t order the groups alphabetically, or setting folders for the Gallery app, very basic theming…

1 Like

You can drop your server back down to default php 7.3 without uninstalling 7.4.
update-alternatives --set php /usr/bin/php7.3
and maybe
update-alternatives --set phar /usr/bin/phar7.3
Test with
php --version

Or if you’re just running a single command you can specify which php
/usr/bin/php7.3 occ … etc

You don’t complain that your nextcloud is completely dead, so I’m guessing php cli was the issue. If you’re seeing an error message for the front end website, use

a2dismod php7.4
a2enmod php.7.3
systemctl restart apache2.service

When your server is compatible with 7.4, you can just set the default by reversing these steps.

The hub just has a few more apps installed by default. Remove them and you’ll have the same Nextcloud as you had before.

When the php version is back to being compatible then how would I make automatic it again? Because this would set it to manual.

I am getting the following error when doing anything with occ is this resolvable?

An unhandled exception has been thrown:
Error: Call to undefined function OC\App\simplexml_load_file() in /var/www/nextcloud/lib/private/App/InfoParser.php:64
Stack trace:
#0 /var/www/nextcloud/lib/private/App/AppManager.php(466): OC\App\InfoParser->parse('/var/www/nextcl...')
#1 /var/www/nextcloud/lib/private/App/AppManager.php(481): OC\App\AppManager->getAppInfo('files')
#2 /var/www/nextcloud/lib/private/legacy/app.php(528): OC\App\AppManager->getAppVersion('files', true)
#3 /var/www/nextcloud/lib/private/legacy/app.php(792): OC_App::getAppVersion('files')
#4 /var/www/nextcloud/lib/private/legacy/util.php(1448): OC_App::shouldUpgrade('files')
#5 /var/www/nextcloud/lib/public/Util.php(515): OC_Util::needUpgrade(Object(OC\SystemConfig))
#6 /var/www/nextcloud/lib/base.php(706): OCP\Util::needUpgrade()
#7 /var/www/nextcloud/lib/base.php(1078): OC::init()
#8 /var/www/nextcloud/console.php(46): require_once('/var/www/nextcl...')
#9 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

I fixed it with installing php7.X-XML php7.X-zip

Not quite. Both versions of php are installed and will continue to update automatically with apt. You can use either one on the server by specifying it on the command line:
/usr/bin/php7.x commands.php
What has changed is the default php which is symlinked to /usr/bin/php
You see the message “set to manual” when you use update-alternatives. That just means that update-alternatives has recognised its not the value it would automatically pick (the latest, ie 7.4). You can get all this info with
update-alternatives --display php
php - manual mode
link best version is /usr/bin/php7.4
link currently points to /usr/bin/php7.3
link php is /usr/bin/php
slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php7.2 - priority 72
slave php.1.gz: /usr/share/man/man1/php7.2.1.gz
/usr/bin/php7.3 - priority 73
slave php.1.gz: /usr/share/man/man1/php7.3.1.gz
/usr/bin/php7.4 - priority 74
slave php.1.gz: /usr/share/man/man1/php7.4.1.gz

" I fixed it with installing php7. X -XML php7. X -zip"
And yes, you now have to remember to install a module into all versions of php!

1 Like

You are a legend.
Thank you very much for your solution and clear explanation of what the fix has done, it is clear and very much appreciated.

I have just updated PHP to 7.4 by running the following code

update-alternatives --auto php
update-alternatives --auto phar

I had the same issue after I ran updates on Ubuntu 18.04. php7.4 got installed and Owncloud wouldn’t work. The error was something like, Owncloud isn’t compatible with php7.4. I tried the suggestions here, and when I tried to access Owncloud through a webpage, I got a 599 error. There was nothing in the logs that gave any hints.

The solution was to disable php7.2 in apache [a2dismod php7.2] than I restarted Apache. The full solution was to run these commands:
update-alternatives --set php /usr/bin/php7.3
update-alternatives --set phar /usr/bin/phar7.3
update-alternatives --set phar.phar /usr/bin/phar.phar7.3
a2dismod php7.2 (disables php7.2 in Apache)
systemctl restart apache2.service

After this the Owncloud site worked, it does show 2 errors.

I have not dealt with these errors yet, but the site is up, so it’s a start. A couple other commands that were helpful; update-alternatives --config php (this shows the php modules) and this query; update-alternatives --query php

Hope this helps

Edit 1: The integrity check error was a #cron.php# file that I moved out the dir. That fixed the one error.
Note: This server has been upgraded from Ubuntu 14.04 so it has older versions of php.
Edit 2: The second error was fixed by adding the line with mod_headers strict to Apache. Turns out none of these errors were related to PHP version.

Normally a good admin uses supported and new operating system versions with php from repository with the coresponding nextcloud version and all is fine.