Running occ with webhoster (IONOS)

Hi, I did find some pieces of info on this but they’re all outdated. :frowning: I’m running a Nextcloud 24.0.1 on my IONOS webspace with PHP 8.0. I don’t have root access to the server, just “regular” ssh and sftp.

I’d like to convert the database and install missing indices and columns as suggested by the admin overview, but I have totally no idea how to issue those occ commands.

Everything I found either uses sudo or refers to the deprecated occ app. (Which I can’t figure out how to install either.) There must certainly be a way to make these adjustments to my Nextcloud instance?

  1. SSH into Server
  2. cd /path/to/your/nextcloud
  3. php ./occ <command>

@coyote Do you know IONOS Managed Nextcloud Hosting. Maybe interesting for you if you are happy with IONOS.

@devnull thanks, but my (legacy) plan has unlimited storage and about 250k files.

@mritzmann thank you too - thing is, that’s what I tried.

...$ php ./occ
Content-type: text/html
 
<br />
<b>Fatal error</b>:  main() [<a href='function.require'>function.require</a>]: Failed opening required '__DIR__/console.php' (include_path='.:/usr/lib/php4.4') in <b>/homepages/14/.../.../.../.../occ</b> on line <b>11</b><br />

and

$ php8.0 ./occ
Content-type: text/html; charset=UTF-8

An unhandled exception has been thrown:
TypeError: OC\AppFramework\Http\Request::getScriptName(): Return value must be of type string, null returned in /homepages/14/.../.../.../.../lib/private/AppFramework/Http/Request.php:804
Stack trace:
#0 /homepages/14/.../.../.../.../lib/base.php(169): OC\AppFramework\Http\Request->getScriptName()
#1 /homepages/14/.../.../.../.../lib/base.php(583): OC::initPaths()
#2 /homepages/14/.../.../..../..../lib/base.php(1104): OC::init()
#3 /homepages/14/.../.../.../.../console.php(48): require_once('/homepages/14/d...')
#4 /homepages/14/.../.../.../.../occ(11): require_once('/homepages/14/d...')

I also tried:

php8.0 (or just php)
./occ -V

That’s doing simply nothing.

Is there a file /path/to/nextcloud/console.php?

???!!!???

On 1 July 2004, PHP 5 was released,

https://en.wikipedia.org/wiki/PHP

Disadvantage of webspace is often that the software is very outdated. It is possible that at some point you will not be able to get the latest Nextcloud together with the web space at all. Webspace is not designed for usage with Nextcloud. But in this case maybe only the old path is used.

Maybe it is a problem with PHP8.0 and you can turn back to PHP 7.4. PHP 7.4 is still supported.

This might work:

Is there a file /path/to/nextcloud/console.php ?

Yes, there is.

???!!!???

Don’t ask me. Does the occ.php file need some kind of editing?

Maybe it is a problem with PHP8.0 and you can turn back to PHP 7.4. PHP 7.4 is still supported.

I can run the php7.4 command, with exactly the same result.

I found a different 80%-solution, though: I installed the occ Web app. I can run the occ commands there, almost all of them except the db:convert-filecache-bigint one. I need to put the thing into maintenance mode for that, which of course shuts down the app as well.

I’ve tried @Bernie_O’s suggestion with exactly his example and adjusted paths, but I just get redirected to the Nextcloud landing page with no txt file ever created.

Well, sort of. I did copy the cron.php, emptied it and added three occ commands:
maintenance:mode --on
db:convert-filechache-bigint
maintenance-mode off
and called it in my browser. the result was that many processes sprung up, all doing the same and leading to “sh: could not fork” errors. Kiling them didn’t really help, but deleting the copied file did. I set the maintenance mode in config.php and dtried with just the db command, but even though I didn’t have many processes running, the command wasn’t executed.

But it works in principle.

Hi.

I encounter the same problem and found a solution. I found that topic as a part of my search so I’m posting here for future reference, despite the old topic.

The problem is created by php interpreter that is very old by default to command line. You can set newer for domain but that doesn’t include php-cli. There is a guide on that https://www.ionos.com/help/hosting/using-php-for-web-projects/executing-php-scripts-in-the-command-line/

So basically a solution

/usr/bin/php7.4-cli occ

In command line is enough.

To make it permanent use the following command lines

mkdir ~/bin
ln -s /usr/bin/php7.4-cli ~/bin/php
echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bash_profile
source $HOME/.bash_profile
1 Like

Awesome, thank you so much. It appears to work for me too.