# I Cannot login. "OCP AutoloadNotAllowedException" in "apps/files\_external/lib/config.php"

**URL:** <https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100>\
**Category:** ℹ️ Support\
**Created:** [August 31, 2020, 7:35pm UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100 "2020-08-31T19:35:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![floogy](https://help.nextcloud.com/user_avatar/help.nextcloud.com/floogy/32/14425_2.png) [@floogy](https://help.nextcloud.com/u/floogy)\
**Post date:** [August 31, 2020, 7:35pm UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100/1 "2020-08-31T19:35:46Z")

</div>

Cannot login. OCP\AutoloadNotAllowedException: Autoload path not allowed: /usr/local/www/nextcloud/apps/files\_external/lib/config.php

```auto
Interner Serverfehler

Der Server konnte die Anfrage nicht fertig stellen.

Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an Deinen Server-Administrator.

Weitere Details können im Server-Protokoll gefunden werden.
Technische Details

    Entfernte Adresse: 84.182.80.3
    Anfragekennung: c8YFCw16p1Ew9if45OTu

```

Nextcloud version : 19.0.2.2  
Operating system and version: FreeBSD 11.3-RELEASE (iocage jail on FreeNAS 11.3-RELEASE U4)  
nginx: 1.18.0  
PHP version: 7.4.9

The issue you are facing:

```auto

{"reqId":"3PZcMlP2gSAWp0nm23oU","level":3,"time":"2020-08-31T19:11:41+00:00","remoteAddr":"84.182.80.3","user":"admin","app":"index","method":"GET","url":"/index.php/csrftoken","message":{"Exception":"OCP\\AutoloadNotAllowedException","Message":"Autoload path not allowed: /usr/local/www/nextcloud/apps/files_external/lib/config.php","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/autoloader.php","line":165,"function":"isValidPath","class":"OC\\Autoloader","type":"->","args":["/usr/local/www/nextcloud/apps/files_external/lib/config.php"]},{"function":"load","class":"OC\\Autoloader","type":"->","args":["OC_Mount_Config"]},{"file":"/usr/local/www/nextcloud/apps-pkg/files_external/appinfo/routes.php","line":33,"function":"spl_autoload_call","args":["OC_Mount_Config"]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":380,"args":["/usr/local/www/nextcloud/apps-pkg/files_external/appinfo/routes.php"],"function":"include_once"},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":151,"function":"requireRouteFile","class":"OC\\Route\\Router","type":"->","args":["/usr/local/www/nextcloud/apps-pkg/files_external/appinfo/routes.php","files_external"]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":268,"function":"loadRoutes","class":"OC\\Route\\Router","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1012,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/csrftoken"]},{"file":"/usr/local/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/lib/autoloader.php","Line":140,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0","version":"19.0.2.2"}
{"reqId":"B5sgGM2Kzmg5rfC02at4","level":1,"time":"2020-08-31T19:13:23+00:00","remoteAddr":"","user":"--","app":"cli","method":"","url":"--","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","userAgent":"--","version":"19.0.2.2"}
{"reqId":"B5sgGM2Kzmg5rfC02at4","level":1,"time":"2020-08-31T19:13:24+00:00","remoteAddr":"","user":"--","app":"cli","method":"","url":"--","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","userAgent":"--","version":"19.0.2.2"}
{"reqId":"B5sgGM2Kzmg5rfC02at4","level":3,"time":"2020-08-31T19:13:24+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":{"Exception":"OCP\\AutoloadNotAllowedException","Message":"Autoload path not allowed: /usr/local/www/nextcloud/apps/files_external/lib/config.php","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/autoloader.php","line":165,"function":"isValidPath","class":"OC\\Autoloader","type":"->","args":["/usr/local/www/nextcloud/apps/files_external/lib/config.php"]},{"function":"load","class":"OC\\Autoloader","type":"->","args":["OC_Mount_Config"]},{"file":"/usr/local/www/nextcloud/apps/files_external/appinfo/app.php","line":38,"function":"spl_autoload_call","args":["OC_Mount_Config"]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":266,"args":["/usr/local/www/nextcloud/apps/files_external/appinfo/app.php"],"function":"require_once"},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":155,"function":"requireAppFile","class":"OC_App","type":"::","args":["files_external"]},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_App.php","line":128,"function":"loadApp","class":"OC_App","type":"::","args":["files_external"]},{"file":"/usr/local/www/nextcloud/lib/private/Console/Application.php","line":127,"function":"loadApps","class":"OC_App","type":"::","args":[]},{"file":"/usr/local/www/nextcloud/console.php","line":99,"function":"loadCommands","class":"OC\\Console\\Application","type":"->","args":[{" __class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{" __class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/usr/local/www/nextcloud/occ","line":11,"args":["/usr/local/www/nextcloud/console.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/lib/autoloader.php","Line":140,"CustomMessage":"--"},"userAgent":"--","version":"19.0.2.2"}

```

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

1. I upgraded from FreeNAS 11.2-RELEASE U8 to 11.3-RELEASE U4  
The warden FreeBSD 11.0-RELEASE, migrated prior to the upgrade to an iocage jail.
2. During upgrade the nextcloud version of 17.0.9.0 was maybe detected as a plugin(?) and therefore was upgraded to 19.0.2.2. But it didn’t work.
3. I upgraded the nc database to 18.0.8. manually and with occ and then let FreeNAS iocage upgrade the ‘plugin’ to 19.0.2.2
4. I used the occ cmd for integrity checks, upgrades and to solve some issues
5. I’m still get the errors listed above.

The output of your Nextcloud log in **Admin \> Logging** :

```auto
can't login

```

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

```auto
root@nextcloud:/usr/local/www/nextcloud # cat config/config.php
<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => true,
    ),
  ),
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'instanceid' => 'ocpgd7phg0fb',
  'passwordsalt' => 'pppppppppppppppppppppppppp',
  'secret' => 'ssssssssssssssssssssssssssssssss',
  'trusted_domains' =>
  array (
    0 => '172.16.240.199',
    1 => '172.16.240.26',
    2 => 'nextcloud.floogy.myhost.eu',
    3 => 'localhost',
    4 => '172.16.240.4',
    5 => '172.16.240.3',
    6 => '172.16.240.16',
    7 => 'floogy.myhost.bz',
    8 => 'floogy.myhost.de',
  ),
  'datadirectory' => '/usr/local/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '19.0.2.2',
  'overwrite.cli.url' => 'https://172.16.240.199',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'mysql.utf8mb4' => true,
  'updater.release.channel' => 'beta',
);

```

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

```auto
root@nextcloud:/usr/local/www/nextcloud # tail -n2 /var/log/nginx/{access,error}.log
==> /var/log/nginx/access.log <==
84.182.80.3 - nextcloud.floogy.myhost.eu [31/Aug/2020:21:26:41 +0200] "GET /index.php/csrftoken HTTP/2.0" 500 5601 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0" "-"rt=1.258 ut=1.257 cs=-
172.16.240.37 - 172.16.240.199 [31/Aug/2020:21:28:20 +0200] "GET /csrftoken HTTP/1.1" 404 146 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0" "-"rt=0.000 ut=- cs=-

==> /var/log/nginx/error.log <==
2020/08/31 21:16:19 [error] 95771#102370: *195 open() "/usr/local/etc/nginx/html/csrftoken" failed (2: No such file or directory), client: 172.16.240.37, server: _, request: "GET /csrftoken HTTP/1.1", host: "172.16.240.199"
2020/08/31 21:28:20 [error] 95771#102370: *198 open() "/usr/local/etc/nginx/html/csrftoken" failed (2: No such file or directory), client: 172.16.240.37, server: _, request: "GET /csrftoken HTTP/1.1", host: "172.16.240.199"

```

GET /index.php/csrftoken HTTP/2.0" 500  
[error] 95771#102370: \*198 open() “/usr/local/etc/nginx/html/csrftoken”

EDIT:  
**I’m able to login, after disabling files\_external!**

```
root@nextcloud:/usr/local/www/nextcloud # sudo -u www php occ app:disable files_external

```

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see [http://php.net/manual/en/book.pcntl.php](http://php.net/manual/en/book.pcntl.php)  
files\_external disabled

---

<div class="post-metadata">

**Author:** ![floogy](https://help.nextcloud.com/user_avatar/help.nextcloud.com/floogy/32/14425_2.png) [@floogy](https://help.nextcloud.com/u/floogy)\
**Post date:** [August 31, 2020, 10:30pm UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100/2 "2020-08-31T22:30:43Z")

</div>

My Files are disappeared, and if I enable “files\_external” with occ or occ web, then the error appears again.

I think, I may mounted a location where my files resides.

With locate I found this place:

```
root@nextcloud:/usr/local/www/nextcloud # du -sh /usr/local/www/nextcloud/data/floogy/files/
9.5G /usr/local/www/nextcloud/data/floogy/files/

```

Ooops, okay, that’s because I’m logged in as admin …

So the most is fine now.

During upgrade I had to create or extent two tables manually.

```auto
MariaDB [nextcloud]> describe oc_flow_operations_scope;
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| operation_id | int(11) | NO | MUL | 0 | |
| type | int(11) | NO | | 0 | |
| value | varchar(64) | YES | | | |
+--------------+-------------+------+-----+---------+----------------+
4 rows in set (0.01 sec)

MariaDB [nextcloud]> describe oc_flow_operations;
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| class | varchar(256) | NO | | NULL | |
| name | varchar(256) | NO | | NULL | |
| checks | longtext | YES | | NULL | |
| operation | longtext | YES | | NULL | |
| entity | varchar(256) | NO | | | |
| events | longtext | NO | | NULL | |
+-----------+--------------+------+-----+---------+----------------+
7 rows in set (0.01 sec)

```

And then upgrade, check integrity and optimize db with occ.

Now there are still three issues in security & configuration

1. [Files Integrity, I guess due to the chaotic upgrade pass] Einige Dateien haben die Integritätsprüfung nicht bestanden. Weiterführende Informationen befinden sich in unserer [Dokumentation](https://docs.nextcloud.com/server/19/go.php?to=admin-code-integrity). ([Liste der ungültigen Dateien…](https://nextcloud.floogy.myhost.eu/settings/integrity/failed) / [Erneut analysieren…]
2. [getenv(“PATH” seems to return an empty response] PHP scheint zur Abfrage von Systemumgebungsvariablen nicht richtig eingerichtet zu sein. Der Test mit getenv(“PATH”) liefert nur eine leere Antwort zurück. Bitte die [Installationsdokumentation ↗](https://docs.nextcloud.com/server/19/go.php?to=admin-php-fpm) auf Hinweise zur PHP-Konfiguration durchlesen sowie die PHP-Konfiguration Deines Servers überprüfen, insbesondere dann, wenn PHP-FPM eingesetzt wird.
3. I cannot use “files\_external”, because it throws the ‘Cannot login. OCP\AutoloadNotAllowedException: Autoload path not allowed: /usr/local/www/nextcloud/apps/files\_external/lib/config.php’
4. I had an error message on the header line: »Falscher privater Schlüssel für die Verschlüsselungs-App. Bitte aktualisieren Sie Ihren privaten Schlüssel in Ihren persönlichen Einstellungen um wieder Zugriff auf die verschlüsselten Dateien zu erhalten« “Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files”
5. There is an issue with some PDF Files for the internal Viewer.

```auto
PDF.js v2.1.266 (build: 81f5835c)
Message: Unexpected server response (503) while retrieving PDF https://nextcloud.floogy.myhost.eu/remote.php/webdav/Nextcloud%20Manual%20(2).pdf".

```

1: Is it safe to delete those files?? [https://pastebin.pl/view/64e13cfd](https://pastebin.pl/view/64e13cfd)

2: Strange, because it returns the $PATH

```
root@nextcloud:/usr/local/www/nextcloud # php -r 'print getenv("PATH") . "\n";'
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin

```

> **[nextcloud PHP Warnung beheben • matthiasdietel.de - 2020](https://matthiasdietel.de/2016/11/14/nextcloud-php-warnung-beheben/)**
>
> Folgende Meldung zeigt nextcloud nach einer Standardinstallation im Admininterface an. Das zu beheben ist recht leicht. PHP scheint zur Abfrage von Systemumgebungsvariablen nicht richtig eingerichtet zu sein. Der Test mit getenv („PATH“) liefert...

3: Anyone?

4: [Falscher privater Schlüssel für die Verschlüsselungs-App. Bitte aktualisieren Sie Ihren privaten Schlüssel in Ihren persönlichen Einstellungen um wieder Zugriff auf die verschlüsselten Dateien zu erhalten](https://help.nextcloud.com/t/falscher-privater-schluessel-fuer-die-verschluesselungs-app-bitte-aktualisieren-sie-ihren-privaten-schluessel-in-ihren-persoenlichen-einstellungen-um-wieder-zugriff-auf-die-verschluesselten-dateien-zu-erhalten/22659/10)  
([Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files](https://help.nextcloud.com/t/invalid-private-key-for-encryption-app-please-update-your-private-key-password-in-your-personal-settings-to-recover-access-to-your-encrypted-files/27108/8))

```auto
root@nextcloud:/usr/local/www/nextcloud # grep '"SAMEORIGIN"' /usr/local/etc/nginx/nginx.conf
root@nextcloud:/usr/local/www/nextcloud # grep '"SAMEORIGIN"' /usr/local/etc/nginx/conf.d/nextcloud.conf
  add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
root@nextcloud:/usr/local/www/nextcloud # grep '"SAMEORIGIN"' .htaccess
    Header always set X-Frame-Options "SAMEORIGIN"

```

5: Seems to happen only on one particular file, maybe it’s corrupt, or to big?

> <https://github.com/nextcloud/server/issues/14384>
>
> Steps to reproduce
> Click on any pdf document to preview
> Expected behaviour
> a preview of the pdf file shows in the web interface
> Actual behaviour
> Error,...

---

<div class="post-metadata">

**Author:** ![floogy](https://help.nextcloud.com/user_avatar/help.nextcloud.com/floogy/32/14425_2.png) [@floogy](https://help.nextcloud.com/u/floogy)\
**Post date:** [September 1, 2020, 1:11pm UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100/3 "2020-09-01T13:11:42Z")

</div>

regarding the bizarre behaviour of 2.: `root@nextcloud:~ # php-fpm -i | egrep --color 'PATH|env' cgi.redirect_status_env => no value => no value PATH => /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin $_SERVER['PATH'] => /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin`

[https://docs.nextcloud.com//server/10/admin\_manual/installation/source\_installation.html#php-fpm-tips-label](https://docs.nextcloud.com//server/10/admin_manual/installation/source_installation.html#php-fpm-tips-label)

But:

```auto
$ LANG=EN wget --no-check-certificate -O - https://172.16.240.39/phpinfo.php | lynx -stdin --dump | egrep -i 'env|path'
--2020-09-01 15:13:24-- https://172.16.240.39/phpinfo.php
Connecting to 172.16.240.39:443... connected.
The certificate's owner does not match hostname '172.16.240.39'
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'STDOUT'

- [<=>] 77.40K --.-KB/s in 0.003s

2020-09-01 15:13:24 (25.4 MB/s) - written to stdout [79253]

   Configuration File (php.ini) Path /usr/local/etc
   cgi.discard_path 0 0
   cgi.fix_pathinfo 1 1
   cgi.redirect_status_env no value no value
   include_path .:/usr/local/share/pear .:/usr/local/share/pear
   realpath_cache_size 4096K 4096K
   realpath_cache_ttl 120 120
   sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
   XPath Support enabled
   openssl.capath no value no value
   session.cookie_path / /
   session.save_path no value no value
   Path to sendmail /usr/sbin/sendmail -t -i
   opcache.lockfile_path /tmp /tmp
   opcache.revalidate_path Off Off
Environment
   $_SERVER['LD_LIBRARY_PATH'] /usr/local/lib:/usr/local/lib
   $_SERVER['PATH'] /sbin:/bin:/usr/sbin:/usr/bin

```

I’m missing the line `PATH => /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin`

> [@Path issue in Nextcloud](https://help.nextcloud.com/t/path-issue-in-nextcloud/5469):
>
> Hello, I got following warning at nextcloud. When I check the Path I got following message: echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games In /etc/php/7.0/fpm/pool.d/www.conf I have these settings: env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp What is wrong? How can I check which path nextcloud is needed?

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 12, 2024, 8:17am UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100/4 "2024-12-12T08:17:10Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 12, 2024, 8:17am UTC](https://help.nextcloud.com/t/i-cannot-login-ocp-autoloadnotallowedexception-in-apps-files-external-lib-config-php/91100/5 "2024-12-12T08:17:11Z")

</div>


