On new install of NC cannot run OCC app:disable of broken app that causes PHP Fatal error

For a few hours I had a fully working Nextcloud system running, tested and customised on new hardware with Ubuntu 18.04, PHP 7.2, Apache2 2.4.29, MariaDB 10.1. Then I went and broke it…!
I had installed the “files_external_gdrive” app with the intention of trying it out. However, I think when I later “disabled” the official “files_external” app, this brought Nextcloud crashing down.

[Thu May 31 13:54:52.088060 2018] [php7:error] [pid 12937] [client] PHP Fatal error: Interface ‘OCA\Files_External\Lib\Config\IBackendProvider’ not found in /var/www/nextcloud/apps/files_external_gdrive/lib/AppInfo/Application.php on line 32

I now needed to use the command-line “OCC” function to disable the broken Google_Drive app. As I am not experienced with this feature I had to research the docs but it did appear straight forward. Yet it wasn’t…

PHP cannot open the OCC script in /var/www/nextcloud and I cannot make out why. Permissions are fine and owner:group is “www-data”. I have not touched (deliberately) the .htaccess file as it’s beyond my brain-power.

My Terminal command attempt is:
sysadmin@Nextcloud-Server-0:~$ sudo -u www-data php occ app:disable files_external_gdrive disabled
[sudo] password for sysadmin:
Could not open input file: occ

PHP has a CLI operation that might be relevant to my problem but it is all “smoke & mirrors” that has me completely baffled.

Any assistance or guidance would be greatly appreciated.

I tend to use the full path when running occ, for this reason. You appear to be in your user’s home directory, so of course PHP can’t find occ in that working directory. I always provide the full path so it doesn’t matter where I am currently:
sudo -u www-data php /var/www/nextcloud/occ app:disable files_external_gdrive

Thanks, that has shown some progress. This is a new area for me to dabble in. PHP is still looking unhappy as the original fatal message is being repeated.

sysadmin@Nextcloud-Server-0:~$ sudo -u www-data php /var/www/nextcloud/occ app:disable files_external_gdrive
[sudo] password for sysadmin:
PHP Fatal error: Interface ‘OCA\Files_External\Lib\Config\IBackendProvider’ not found in /var/www/nextcloud/apps/files_external_gdrive/lib/AppInfo/Application.php on line 32

I don’t understand why this busted app is being re-driven by PHP after the OCC “disable” procedure. I will have a sniff around in the log for clues.

Now that I know how to invoke the OCC console correctly (thank-you “linucksrox”), I can see that my Nextcloud is mortally wounded. Even the status cannot be displayed.

sudo -u www-data php /var/www/nextcloud/occ status
[sudo] password for sysadmin:
PHP Fatal error: Interface ‘OCA\Files_External\Lib\Config\IBackendProvider’ not found in /var/www/nextcloud/apps/files_external_gdrive/lib/AppInfo/Application.php on line 32

I’m a complete “numpty” with my knowledge of PHP but I suspect the “smoking gun” is in the hand of app “files_external_gdrive” (0.2.8) and that it (with my help(?) has broken the core code.
I will go now and report the problem to this Google-Drive app developer (Samy Nastuzzi) and see if the underlying cause can be found. (Bye for Now)

If you could share a link where you reported the issue would be nice for people who follow the same topic. I was wondering if this might not even be an issue for nextcloud itself if an app can this easily break the setup. Especially when it is distributed via the app store, we could imagine some basic test routines such as enable and disable app. @BernhardPosselt

To disable the app, you can also delete the folder of the app (/var/www/nextcloud/apps/files_external_gdrive). Existing external storage to gdrive will probably disappear, since most of this information is hold in the database, the information is not lost and can be used again once a working version is available (or ideally the apps are programmed this way).

What do you mean? Store is written in Python and executing user provided code to check if it’s valid PHP is madness.

There are some automated tests in place for the NC code. Wouldn’t it be possible to run a test setup, install apps during the night and try a few basic operations like enabling or disabling them. Or if they try to create an external connection, …
Or a way that the occ command does not automatically load app code for some features…

Also for the development such an infrastructure could be helpful for developers. NC 14 is not announced yet, it will drop for example php 5.x support. It could be helpful to have a full picture which apps are not compatible and it leaves some time to reach out to the developers or the community and does not leave users with a bad surprise that their favorite app is not working any more since the last upgrade.

I have no idea how difficult it is to put such things in place or if different approaches are easier and more efficient.

PHP compatibility is all handled via the info.xml. Also Nextcloud 13 ships with a feature afaik that will tell you if you can upgrade to the next version with all of your apps.

That’s what CI is actually doing, but it’s the app authors job to test the app btw.

As this now looks like an “app” problem and not related to “installation”, I have posted a new entry here: Google-Drive External Files (0.2.8). App suspected of involvement in my “PHP Fatal error:” (Sev-1)
I hope this is the correct procedure.

I thought I’d wake this thread back up after finding this via a Google search as I’ve just experienced the same issue after installing the Google-Drive External Files App.

PHP Fatal error: Interface ‘OCA\Files_External\Lib\Config\IBackendProvider’ not found in /usr/local/www/nextcloud/apps/files_external_gdrive/lib/AppInfo/Application.php on line 32
root@nextcloud:/usr/local/www/nextcloud # sudo -u www-data php /var/www/nextcloud/occ app:disable files_external_gdrive
sudo: unknown user: www-data
sudo: unable to initialize policy plugin
root@nextcloud:/usr/local/www/nextcloud # sudo -u www-data php /var/www/nextcloud/occ status
sudo: unknown user: www-data
sudo: unable to initialize policy plugin

I assume NextCloud fatally damaged. I’ll do a re-install since this is a initial setup.

I posted here…