Can't scan the files after adding them via ftp

Hi there,

I’ve installed NextCloud on A2hosting (i have root access) and i’ve installed the nextcloud on my computer. After adding some folder i’ve found that the upload was very very slow so i decided to add the folder via ftp directly to the nextcloud files folder. This method was very fast but the files don’t appear in the nextcloud so i’ve searched and found that i could run a command to solve this issue:

sudo -u user php occ files:scan --all

but when i run this command i get this error:

TypeError: Return value of OC\AppFramework\Http\Request::getScriptName() must be of the type string, null returned in /home/***/lib/private/AppFramework/Http/Request.php:796
Stack trace:
#0 /home/***/lib/base.php(154): OC\AppFramework\Http\Request->getScriptName()
#1 /home/***/lib/base.php(591): OC::initPaths()
#2 /home/***/lib/base.php(1068): OC::init()
#3 /home/***/console.php(46): require_once(’/home/***/…’)
#4 /home/***/occ(10): require_once(’/home/***/…’)

i don’t know if there’s any optimizations that i can so my Nextcloud works faster and the way i can scan the files that i’ve uploaded via ftp.

thank you!

regards!

I think the occ command should run as the user of the apache server, that is www-data on a Debian system. Are you sure it runs as user php?

sorry, i’ve used the “user” in the explanation but i’ve run the command in my computer with “root” and with my username.
if i try with www-data i get the error:

sudo: unknown user: www-data
sudo: unable to initialize policy plugin

which os you are using?
which webserver are you using?

with ps -ef you should find a process (and user name) of your web server (nginx/apache/httpd).

(and please. we have 2018. no one is using ftp anymore. scp/sftp/ftps if you have to.)

1 Like

What is the owner of the nextcloud directory? Is it in /var/www or in your home directory?

no, my nextcloud directory it’s on a subdomain like this nextcloud.mycompany.com
inside this folder is all the nextcloud files

I was asking for the directory on the server, and the OS owner.

Hi @absint0o You need to run that as user www-data and either with the full path to /var/www/nextcloud/occ or cd to the directory first.

cd /var/www/nextcloud

Instead of using –all you can specify the –path to the directory you uploaded to:

sudo -u www-data php occ files:scan --path="/user/files/ftp_upload_directory"