Nextcloud version: 26.0.3
Operating system and version: Debian 11
Apache or nginx version: Apache 2.4.56
PHP version: 8.1
The issue you are facing:
After updating Nextcloud. The update script removes/ does not set the executable flag (+x) on the occ script. Since it has the shebang line, it can directly be executed.
Is this the first time you’ve seen this error?: No
Steps to replicate it:
Update Nextcloud
Executable Flag is missing on occ script
I did not include any config files. If there is a config flag, i missed it.
I have observed at various instances that the update script updater/updater.phar sets the execution bit, but the webupdater does not.
I’ve never seen a problem with it. If you updates via webupdater, you may probably have less to do with occ anyway. If you are more command line-affin, you will propably do your update with updater.phar anyway and get the execution bit set as a small bonus. If not set and you need it later, you can set it yourself.
In the manuals it is described everywhere to call occ as an argument of php.
I never call occ directly. For direct use on the commandline I have it as pre loaded alias / function loaded by ~/.bashrc (or rather ~/.bash_aliases which is loaded by ~/.bashrc):
NC_DIR="/var/www/nextcloud"
HT_USER="$(ls -l $NC_DIR/config/config.php 2>/dev/null | awk '{print $3}')"
alias suht='sudo -u $HT_USER'
# using the -E (or --preserve-env) option with sudo to preserve the environment variables:
alias suhtphp='suht -E /usr/bin/php'
occ() { suhtphp -f "$NC_DIR/occ" "$@"; }
The reason I put occ in a function and not in an alias is that → autocompletion ← doesn’t work on aliases.
For use in scripts or cronjobs I cal php with occ as argument.