Could not open input file: occ


#1

Hello everybody,
I had an owncloud 9 installation on my Kubuntu 16.04 installed from repo up and running
with sqlite.
Now I want to change to nextcloud 11.0.2
I first removed the owncloud repository installation with synaptic.
Renamed my old /var/www/owncloud dir to /var/www/nextcloud and copied all the files into it.
Now I am stuck at the point that I can not open the occ file:

et@ets:/var/www/nextcloud$ sudo -u www-data php occ
Could not open input file: occ
et@ets:/var/www/nextcloud$ cat occ
#!/usr/bin/env php
<?php
/**
_ * Copyright © 2013 Thomas Müller thomas.mueller@tmit.eu_
_ * This file is licensed under the Affero General Public License version 3 or_
_ * later._
_ * See the COPYING-README file._
_ */_

_//$argv = $SERVER[‘argv’];
require_once DIR . ‘/console.php’;
et@ets:/var/www/nextcloud$ ls -la occ
-rw-r-xr-x 1 www-data www-data 283 Feb 26 20:42 occ

Any idea what I am doing wrong?
linufix


#2

Did you manage to find a solution to this? I just migrated from Nextcloud 10 to Nextcloud 12, and am stuck at exactly the same point… And yes, I am executing this - like you - in the nextcloud folder…

Seems to be a php-related problem (executing occ without sudo and php in front works, but throws the error that I need to execute occ as user www-data; but as www-data, I get “Could not open input file: occ”), but I can’t figure out, what it is…

Edit: Well, maybe not a php problem. After going back to Nextcloud 10, everything works again…?!


#3

The file permissions are looking odd. The owner ‘www-data’ has no permission to run the script because of the missing eXecution right.

Try fixing this with…
sudo chmod 744 /path/to/occ

If it still doesn’t work try to use full absolute path to occ (/path/to/occ).
sudo -u www-data php /path/to/occ update

Further information:
https://docs.nextcloud.com/server/11/admin_manual/configuration_server/occ_command.html


#4

I found the solution: I had executed the chown -R www-data:www-data step from within the nextcloud folder with * - this omits changing the owner for all hidden files (starting with .). Apache thus was not able to access .htaccess when occ should be run. chown -R www-data:www-data .* resolved the problem.


#5

I’m having the exact same problem but with different setup.

I upgraded from NC11 to NC12 on nginx running on Ubuntu 16.04 and I’m running the setup in www main directory (not /nextcloud).

I verified the whole directory is owned by www-data and has write&execute rights.

root@server:/var/www# sudo -u www-data php occ upgrade
Could not open input file: occ

#6

I have The Same problem during The Update to The latest version. My Pi stucks in the Maintance Mode.

what i have to do to fix it ?


#7

Hi,

If you were supposed to solve the problem and you only have this much information:

How would attempt to solve this problem? :wink:

Please read the posts above, they provide some good ideas, about what you could try.


#8

i have install The latest Update from Nextcloud.
My system stucks in The Maintancemode. I have try to switch it off with a command.

I have try the commands above

Edit: where (how) i find The Path to The occ file ?

Sorry für My english, im from Germany


#9

I sent you a PM.


#10

This doesn’t help the community. Please post the solution openly so that we all can benefit.


#11

I managed to get a solution here with Nextcloud 15 Beta. Hope this helps someone out.

First, I’m running Ngnix so I had to get the user account to run this under (nginx).
Then I had to install the php-process package via yum. I’m running PHP 7.2 with Nextcloud, and it wasn’t installed by default.
Then I had to cd to the folder in order to run it (/var/www/nextcloud for me).
Finally I could run the command like this successfully:

sudo -u nginx php occ files:scan [username] -v

This worked just fine, after I had deleted everything from the user’s folder and then rescanned it. Now I will rsync over their data from backup, rescan again, and should have the content back.

Hope this helps.


#12

find /var/www/nextcloud/ -iname *occ*
/var/www/nextcloud/public_html/occ

Then:
sudo -u www-data php /var/www/nextcloud/public_html/occ db:convert-filecache-bigint