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,

PHP - Wikipedia

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.