How to use occ commands on a Shared Hosting without SSH access

On some hosters it is possible to use a separate PHP-file to perform occ commands. It depends on the settings of the hoster though, whether that will work or not (it works with mine). It might be worth a try:

  1. create a file on your webspace called occ-command.php (or whatever you wanna call it) with the following content (adjust RELATIVE/PATH/TO/occ to point to your occ in the nextcloud-installation folder; also the path to php possibly needs to be adjusted):
    <?php 
       exec("/usr/bin/php -d memory_limit=1024M RELATIVE/PATH/TO/occ -n status > occ_result.txt");
       exec("echo \"Command completed!\" >> occ-result.txt");
       header('Location: occ-result.txt');
    ?>
    
  2. visit occ-command.php with a browser
  3. after executing the command, the browser will be redirected to a logfile (occ-result.txt)
  4. for security reasons it is better to delete occ-command.php and occ-result.txt from your webserver when you are done.
3 Likes

Hello [rakekniven],

I installed this app on my Nextcloud which is hosted on Hetzner.

However, it is not clear to me how I should then run occ…

If I just type
update
then nothing happens

Once in OCCweb, which command shall I use to upgrade to the next nextcloud version ?

Thank you !
Vincent

Please see https://apps.nextcloud.com/apps/occweb and https://git.adphi.net/adphi/occweb

This app is deprecated and should not be used anymore.

btw. it was never designed for upgrading an NC instance.